Skip to content

Commit c3e3d12

Browse files
committedFeb 7, 2020
added webpack analyze
1 parent e04cb09 commit c3e3d12

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎package.json

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"unpkg": "./dist/georaster.browser.bundle.min.js",
1010
"scripts": {
11+
"analyze": "ANALYZE_GEORASTER_BUNDLE=true npm run build",
1112
"eslint": "node ./node_modules/eslint/bin/eslint.js src",
1213
"fix": "node ./node_modules/eslint/bin/eslint.js src --fix",
1314
"test": "npm run test-dev",
@@ -58,6 +59,7 @@
5859
"eslint-config-google": "^0.11.0",
5960
"mocha": "^6.2.0",
6061
"webpack": "^4.12.0",
62+
"webpack-bundle-analyzer": "^3.6.0",
6163
"webpack-cli": "^3.0.8"
6264
}
6365
}

‎webpack.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
const path = require('path');
2+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
23

34
module.exports = (env, argv) => {
45
console.log('mode:', argv.mode);
56
console.log('target:', argv.target);
67
const {mode, target} = argv;
78
const targetFileNamePart = target === 'node' ? '' : '.browser';
9+
10+
const plugins = []
11+
if (process.env.ANALYZE_GEORASTER_BUNDLE) {
12+
plugins.push(BundleAnalyzerPlugin({
13+
analyzerHost: process.env.ANALYZER_HOST || "127.0.0.1"
14+
}));
15+
}
816
return {
917
entry: './src/index.js',
1018
mode,
@@ -49,5 +57,6 @@ module.exports = (env, argv) => {
4957
// activating geotiff.js' makeFetchSource function when using fromUrl
5058
'node-fetch': 'node-fetch',
5159
},
60+
plugins
5261
};
5362
};

0 commit comments

Comments
 (0)
Please sign in to comment.