webpack: switch devtool to eval-source-map, use in development mode only
This commit is contained in:
parent
35c49f8666
commit
c87d044687
1 changed files with 34 additions and 27 deletions
|
@ -1,8 +1,8 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env, argv) => {
|
||||||
|
let config = {
|
||||||
entry: './src/index.ts',
|
entry: './src/index.ts',
|
||||||
devtool: 'inline-source-map',
|
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: './dist'
|
contentBase: './dist'
|
||||||
},
|
},
|
||||||
|
@ -28,4 +28,11 @@ module.exports = {
|
||||||
filename: 'bundle.js',
|
filename: 'bundle.js',
|
||||||
path: path.resolve(__dirname, 'dist')
|
path: path.resolve(__dirname, 'dist')
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (argv.mode === 'development') {
|
||||||
|
config.devtool = 'eval-source-map';
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue