-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathwebpack.config.libs_external.js
37 lines (35 loc) · 1.14 KB
/
webpack.config.libs_external.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
33
34
35
36
37
import path, { dirname } from "path";
import TerserPlugin from "terser-webpack-plugin";
import { fileURLToPath } from "url";
import ModuleScopePlugin from "@k88/module-scope-plugin";
export default (isLiveBuild, buildInfo, minify = false, analyze = false) =>
{
const __dirname = dirname(fileURLToPath(import.meta.url));
const config = {
"mode": isLiveBuild ? "production" : "development",
"entry": [
path.join(__dirname, "libs", "index.js")
],
"devtool": minify ? "source-map" : false,
"output": {
"path": path.join(__dirname, "build"),
"filename": "libs.core.js"
},
"optimization": {
"concatenateModules": true,
"minimizer": [new TerserPlugin({
"extractComments": false,
"terserOptions": { "output": { "comments": false } }
})],
"minimize": minify,
"usedExports": true
},
"resolve": {
"extensions": [".js"],
"plugins": [
new ModuleScopePlugin.default("libs/"),
],
}
};
return config;
};