diff options
-rw-r--r-- | webpack.config.js | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/webpack.config.js b/webpack.config.js index 0bb19e9..cb4dd34 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,31 +1,38 @@ const path = require('path'); -module.exports = { - entry: './src/index.ts', - devtool: 'inline-source-map', - devServer: { - contentBase: './dist' - }, - module: { - rules: [ - { - test: /\.ts$/, - use: 'ts-loader', - exclude: /node_modules/ - }, +module.exports = (env, argv) => { + let config = { + entry: './src/index.ts', + devServer: { + contentBase: './dist' + }, + module: { + rules: [ { - test: /\.(vs|fs)$/, - use: [ - 'raw-loader' - ] - } - ] - }, - resolve: { - extensions: [ ".ts", ".js" ] - }, - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, 'dist') - }, + test: /\.ts$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /\.(vs|fs)$/, + use: [ + 'raw-loader' + ] + } + ] + }, + resolve: { + extensions: [ ".ts", ".js" ] + }, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, 'dist') + }, + }; + + if (argv.mode === 'development') { + config.devtool = 'eval-source-map'; + } + + return config; }; |