Skip to content

Commit e411c20

Browse files
committed
fix invalid plugin setting
1 parent d72f2f2 commit e411c20

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build": "npm run build:version && npm run build:embed",
1212
"build:version": "node ./scripts/build-version.mjs",
1313
"build:embed": "MAP_PLATFORM_STAGE=v1 webpack --mode production && cp ./dist/embed.js ./dist/embed && cp -r ./dist/* ./docs/ && rm -rf ./docs/*.d.ts ./docs/lib/",
14-
"analyze": "ANALYZE=true webpack --mode production",
14+
"analyze": "ANALYZE=true MAP_PLATFORM_STAGE=v1 webpack --mode production",
1515
"format": "prettier-eslint \"./src/**/*.ts\" --write",
1616
"lint": "eslint --ext .js,.cjs,.mjs,.jsx,.ts,.tsx .",
1717
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' NODE_OPTIONS=\"--no-experimental-strip-types\" mocha",

webpack.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ const path = require('path');
22
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
33
const { DefinePlugin } = require('webpack');
44

5+
const plugins = [
6+
new DefinePlugin({
7+
'process.env.MAP_PLATFORM_STAGE': JSON.stringify(process.env.MAP_PLATFORM_STAGE || 'dev'),
8+
})
9+
];
10+
if (process.env.ANALYZE === 'true') {
11+
plugins.push(new BundleAnalyzerPlugin());
12+
}
513
module.exports = {
614
entry: './src/embed.ts',
715
output: {
@@ -15,10 +23,7 @@ module.exports = {
1523
type: 'umd',
1624
},
1725
},
18-
plugins: process.env.ANALYZE === 'true' ? [new BundleAnalyzerPlugin()] : [
19-
new DefinePlugin({
20-
'process.env.MAP_PLATFORM_STAGE': JSON.stringify(process.env.MAP_PLATFORM_STAGE || 'dev'),
21-
})],
26+
plugins: plugins,
2227
module: {
2328
rules: [
2429
{

0 commit comments

Comments
 (0)