-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig-overrides.js
32 lines (29 loc) · 1.08 KB
/
config-overrides.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
module.exports = function override(config, env) {
config.plugins.push(new CopyPlugin({
patterns: [
{from: 'public', to: 'public'}
]
}))
if (process.env.NO_BUNDLE_ANALYSER !== "true") {
config.plugins.push(new BundleAnalyzerPlugin());
}
if (process.env.BUILD_TARGET === "lib") {
config.entry = [
path.resolve(process.cwd(), "src", "libroot.ts")
]
config.output = {
path: config.output.path,
filename: 'web-marker.js',
library: "web-marker",
libraryTarget: "umd",
}
delete config.optimization["splitChunks"];
delete config.optimization["runtimeChunk"];
config.externals = ["react", "react-dom"];
config.plugins = config.plugins.filter(p => ["HtmlWebpackPlugin", "GenerateSW", "ManifestPlugin"].indexOf(p.constructor.name) < 0)
}
return config;
}