ts-config-webpack-plugin
v2.0.3
Published
Preset for typescript webpack configuration
Downloads
2,679
Readme
ts-config-webpack-plugin
Creating a webpack loader configurations can be quite time consuming.
The ts-config-webpack-plugin
is part of the common-config-webpack-plugin
suite which tries to provide best practices for the most common loader requirements.
If no mode is explicitly set for the plugin the configuration will adjust depending on your webpack mode setting.
The injected configurations are based on ts-loader thread-loader example.
⚙️development mode webpack.config.js
⚙️production mode webpack.config.js
Installation
npm i --save-dev ts-config-webpack-plugin
Webpack Config
In most projects you will need to set up project specific options but you can still use all or some common-config-webpack-plugin parts.
const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');
module.exports = {
plugins: [new TsConfigWebpackPlugin()],
};
tsconfig.json
By default the ts-config-webpack-plugin
uses the tsconfig plugin to locate the tsconfig file.
To change the default location an option called configFile
can be passed to the ts-config-webpack-plugin
.
If no configuration can be determined the src/config/tsconfig.base.json file will be used as fallback.
const TsConfigWebpackPlugin = require('ts-config-webpack-plugin');
module.exports = {
plugins: [
new TsConfigWebpackPlugin({
configFile: '/foo/bar/tsconfig.json',
}),
],
};