I want to use webpack just as a typescript build tool, such that each typescript file is translated into 1 js file.
The webpack guide has this configuration:
module.exports = {
entry: './app.tsx',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
};
question: Is it possible to modify this such that
- each ts file translates into 1 js file and (more compliated)
- such that no bundling occurs, and no module-webpack-boilerplate is produced?
remarks:
I know I can use tsc for that, but for some reasons I would like to use webpack if possible. I simplified my scenario.
There is another question sounding like the very same but the answers there do not answer anything for me: How to disable bundling in Webpack for development?
I understand you want to forego bundling and use the loaders with Webpack. I myself had considered this to speed up my dev build process. However, I believe the question you linked to states the answer correctly: this is not currently possible. The best approach is to use the
devtool
property in the Webpack config to enable sourcemaps. An alternative would be to use Gulp or Grunt for the dev build if all you want is to process TypeScript.