Use external source map

master
Vitaliy Filippov 2019-08-31 02:38:54 +03:00
parent 6b9dbe3b73
commit 31e860f359
2 changed files with 7 additions and 7 deletions

View File

@ -32,9 +32,9 @@
"webpack-cli": "^3.1.2" "webpack-cli": "^3.1.2"
}, },
"scripts": { "scripts": {
"compile": "webpack --mode=production --optimize-minimize; nodejs copy-css.js", "compile": "webpack --mode=production --optimize-minimize",
"stats": "NODE_ENV=production webpack --mode=production --optimize-minimize --profile --json > stats.json; webpack-bundle-analyzer stats.json -h 0.0.0.0", "stats": "webpack --mode=production --optimize-minimize --profile --json > stats.json; webpack-bundle-analyzer stats.json dist -h 0.0.0.0",
"watch-dev": "NODE_ENV=development webpack --mode=development -w", "watch-dev": "webpack --mode=development -w",
"watch": "webpack --mode=production -w --optimize-minimize" "watch": "webpack --mode=production -w --optimize-minimize"
} }
} }

View File

@ -1,7 +1,7 @@
const webpack = require('webpack'); const webpack = require('webpack');
const path = require('path'); const path = require('path');
module.exports = { module.exports = (env, argv) => ({
entry: { entry: {
main: [ "babel-polyfill", './main.js' ] main: [ "babel-polyfill", './main.js' ]
}, },
@ -10,7 +10,7 @@ module.exports = {
path: __dirname+'/dist', path: __dirname+'/dist',
filename: '[name].js' filename: '[name].js'
}, },
devtool: 'inline-source-map', devtool: 'cheap-module-source-map',
module: { module: {
rules: [ rules: [
{ {
@ -44,7 +44,7 @@ module.exports = {
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
"process.env": { "process.env": {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || "production") NODE_ENV: JSON.stringify(argv.mode || "production")
} }
}) })
], ],
@ -52,4 +52,4 @@ module.exports = {
maxEntrypointSize: 5000000, maxEntrypointSize: 5000000,
maxAssetSize: 5000000 maxAssetSize: 5000000
} }
}; });