I am facing an issue with my webpack.config.js
file that has a default entrypoint specified. Here is the snippet of the configuration:
module.exports = {
entry: {
main: path.resolve('./src/main.ts'),
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
use: ['babel-loader'],
...
},
...
],
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
...
},
...
};
When I run npx webpack
, it successfully builds the main.ts
file. However, when I try to build a .ts
file by passing it as an argument like this:
npx webpack someScript.ts
Webpack CLI seems to ignore the input file argument and still builds the default entrypoint without any warning or error message.
Has anyone encountered this problem before and found a solution to make Webpack CLI build a .ts
file properly?