I have a webpack.config.js file with a default entrypoint, i.e.:
module.exports = {
entry: {
main: path.resolve('./src/main.ts'),
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
use: ['babel-loader'],
...
},
...
],
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
...
},
...
};
Running npx webpack directly builds main.ts as expected. In addition, if I pass in an input file as an argument, it can build any .js files:
npx webpack someScript.js
However, with a .ts file, it ignores the input file argument and builds the default entrypoint instead. It doesn't even show a warning.
How can I get Webpack CLI to build a .ts file?