@umijs/bundler-webpack 4.0.5 → 4.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/{dist → client}/client/client.d.ts +0 -0
  2. package/client/client/client.js +172 -192
  3. package/client/constants.d.ts +15 -0
  4. package/client/constants.js +28 -19
  5. package/client/utils/formatWebpackMessages.d.ts +12 -0
  6. package/client/utils/formatWebpackMessages.js +68 -86
  7. package/dist/build.d.ts +1 -1
  8. package/dist/build.js +105 -61
  9. package/dist/cli.js +77 -69
  10. package/dist/config/_sampleFeature.js +33 -9
  11. package/dist/config/assetRules.js +45 -36
  12. package/dist/config/bundleAnalyzerPlugin.js +39 -17
  13. package/dist/config/compressPlugin.js +113 -95
  14. package/dist/config/config.d.ts +1 -0
  15. package/dist/config/config.js +204 -215
  16. package/dist/config/copyPlugin.js +58 -33
  17. package/dist/config/cssRules.js +136 -131
  18. package/dist/config/definePlugin.d.ts +1 -0
  19. package/dist/config/definePlugin.js +71 -31
  20. package/dist/config/detectDeadCode.js +120 -108
  21. package/dist/config/detectDeadCodePlugin.js +78 -63
  22. package/dist/config/fastRefreshPlugin.js +39 -20
  23. package/dist/config/forkTSCheckerPlugin.js +38 -19
  24. package/dist/config/harmonyLinkingErrorPlugin.js +48 -29
  25. package/dist/config/ignorePlugin.js +38 -14
  26. package/dist/config/javaScriptRules.js +146 -173
  27. package/dist/config/manifestPlugin.js +51 -15
  28. package/dist/config/miniCSSExtractPlugin.js +42 -22
  29. package/dist/config/nodePolyfill.js +65 -26
  30. package/dist/config/nodePrefixPlugin.js +36 -12
  31. package/dist/config/progressPlugin.js +37 -13
  32. package/dist/config/purgecssWebpackPlugin.js +41 -19
  33. package/dist/config/speedMeasureWebpackPlugin.js +41 -20
  34. package/dist/config/ssrPlugin.js +83 -63
  35. package/dist/config/svgRules.js +74 -46
  36. package/dist/constants.js +57 -22
  37. package/dist/dev.d.ts +1 -1
  38. package/dist/dev.js +170 -129
  39. package/dist/index.d.ts +0 -2
  40. package/dist/index.js +22 -35
  41. package/dist/loader/svgr.js +73 -54
  42. package/dist/loader/swc.js +110 -69
  43. package/dist/parcelCSS.d.ts +2 -0
  44. package/dist/parcelCSS.js +32 -0
  45. package/dist/plugins/ProgressPlugin.js +66 -43
  46. package/dist/plugins/RuntimePublicPathPlugin.js +42 -23
  47. package/dist/plugins/_SamplePlugin.js +39 -14
  48. package/dist/requireHook.js +37 -27
  49. package/dist/schema.js +119 -95
  50. package/dist/server/server.d.ts +0 -1
  51. package/dist/server/server.js +214 -184
  52. package/dist/server/ws.d.ts +0 -2
  53. package/dist/server/ws.js +63 -38
  54. package/dist/swcPlugins/autoCSSModules.js +50 -31
  55. package/dist/swcPlugins/changeImportFromString.js +31 -9
  56. package/dist/swcPlugins/lockCoreJS.js +44 -20
  57. package/dist/types.js +61 -30
  58. package/dist/utils/browsersList.js +31 -8
  59. package/dist/utils/depMatch.js +63 -39
  60. package/dist/utils/formatWebpackMessages.js +93 -91
  61. package/dist/utils/getEsBuildTarget.js +32 -10
  62. package/package.json +9 -11
  63. package/compiled/fork-ts-checker-webpack-plugin/LICENSE +0 -21
  64. package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
  65. package/compiled/fork-ts-checker-webpack-plugin/index.js +0 -42
  66. package/compiled/fork-ts-checker-webpack-plugin/package.json +0 -1
  67. package/dist/client/client.js +0 -245
@@ -1,35 +1,60 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addCopyPlugin = void 0;
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // copyPlugin.ts
20
+ var copyPlugin_exports = {};
21
+ __export(copyPlugin_exports, {
22
+ addCopyPlugin: () => addCopyPlugin
23
+ });
24
+ module.exports = __toCommonJS(copyPlugin_exports);
25
+ var import_fs = require("fs");
26
+ var import_path = require("path");
6
27
  async function addCopyPlugin(opts) {
7
- var _a;
8
- const { config, userConfig, cwd } = opts;
9
- const copyPatterns = [
10
- (0, fs_1.existsSync)((0, path_1.join)(cwd, 'public')) && {
11
- from: (0, path_1.join)(cwd, 'public'),
12
- },
13
- ...(userConfig.copy
14
- ? (_a = userConfig.copy) === null || _a === void 0 ? void 0 : _a.map((pattern) => {
15
- if (typeof pattern === 'string') {
16
- return (0, path_1.resolve)(cwd, pattern);
17
- }
18
- return {
19
- from: (0, path_1.resolve)(cwd, pattern.from),
20
- to: (0, path_1.resolve)(cwd, pattern.to),
21
- };
22
- })
23
- : []),
24
- ].filter(Boolean);
25
- if (copyPatterns.length) {
26
- config
27
- .plugin('copy')
28
- .use(require('@umijs/bundler-webpack/compiled/copy-webpack-plugin'), [
29
- {
30
- patterns: copyPatterns,
31
- },
32
- ]);
33
- }
28
+ var _a;
29
+ const { config, userConfig, cwd } = opts;
30
+ const copyPatterns = [
31
+ (0, import_fs.existsSync)((0, import_path.join)(cwd, "public")) && {
32
+ from: (0, import_path.join)(cwd, "public"),
33
+ info: { minimized: true }
34
+ },
35
+ ...userConfig.copy ? (_a = userConfig.copy) == null ? void 0 : _a.map((pattern) => {
36
+ if (typeof pattern === "string") {
37
+ return {
38
+ from: (0, import_path.resolve)(cwd, pattern),
39
+ info: { minimized: true }
40
+ };
41
+ }
42
+ return {
43
+ from: (0, import_path.resolve)(cwd, pattern.from),
44
+ to: (0, import_path.resolve)(cwd, pattern.to),
45
+ info: { minimized: true }
46
+ };
47
+ }) : []
48
+ ].filter(Boolean);
49
+ if (copyPatterns.length) {
50
+ config.plugin("copy").use(require("@umijs/bundler-webpack/compiled/copy-webpack-plugin"), [
51
+ {
52
+ patterns: copyPatterns
53
+ }
54
+ ]);
55
+ }
34
56
  }
35
- exports.addCopyPlugin = addCopyPlugin;
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ addCopyPlugin
60
+ });
@@ -1,137 +1,142 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addCSSRules = void 0;
4
- const utils_1 = require("@umijs/utils");
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+
39
+ // cssRules.ts
40
+ var cssRules_exports = {};
41
+ __export(cssRules_exports, {
42
+ addCSSRules: () => addCSSRules
43
+ });
44
+ module.exports = __toCommonJS(cssRules_exports);
45
+ var import_utils = require("@umijs/utils");
5
46
  async function addCSSRules(opts) {
6
- const { config, userConfig } = opts;
7
- const rulesConfig = [
8
- { name: 'css', test: /\.css(\?.*)?$/ },
9
- {
10
- name: 'less',
11
- test: /\.less(\?.*)?$/,
12
- loader: require.resolve('@umijs/bundler-webpack/compiled/less-loader'),
13
- loaderOptions: {
14
- implementation: require.resolve('@umijs/bundler-utils/compiled/less'),
15
- lessOptions: {
16
- modifyVars: userConfig.theme,
17
- javascriptEnabled: true,
18
- ...userConfig.lessLoader,
19
- },
20
- },
21
- },
22
- {
23
- name: 'sass',
24
- test: /\.(sass|scss)(\?.*)?$/,
25
- loader: require.resolve('@umijs/bundler-webpack/compiled/sass-loader'),
26
- loaderOptions: userConfig.sassLoader || {},
47
+ const { config, userConfig } = opts;
48
+ const rulesConfig = [
49
+ { name: "css", test: /\.css(\?.*)?$/ },
50
+ {
51
+ name: "less",
52
+ test: /\.less(\?.*)?$/,
53
+ loader: require.resolve("@umijs/bundler-webpack/compiled/less-loader"),
54
+ loaderOptions: {
55
+ implementation: require.resolve("@umijs/bundler-utils/compiled/less"),
56
+ lessOptions: __spreadValues({
57
+ modifyVars: userConfig.theme,
58
+ javascriptEnabled: true
59
+ }, userConfig.lessLoader)
60
+ }
61
+ },
62
+ {
63
+ name: "sass",
64
+ test: /\.(sass|scss)(\?.*)?$/,
65
+ loader: require.resolve("@umijs/bundler-webpack/compiled/sass-loader"),
66
+ loaderOptions: userConfig.sassLoader || {}
67
+ }
68
+ ];
69
+ for (const { name, test, loader, loaderOptions } of rulesConfig) {
70
+ const rule = config.module.rule(name);
71
+ const nestRulesConfig = [
72
+ userConfig.autoCSSModules && {
73
+ rule: rule.test(test).oneOf("css-modules").resourceQuery(/modules/),
74
+ isCSSModules: true
75
+ },
76
+ {
77
+ rule: rule.test(test).oneOf("css").sideEffects(true),
78
+ isCSSModules: false
79
+ }
80
+ ].filter(Boolean);
81
+ for (const { rule: rule2, isCSSModules } of nestRulesConfig) {
82
+ if (userConfig.styleLoader) {
83
+ rule2.use("style-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/style-loader")).options(__spreadValues({ base: 0, esModule: true }, userConfig.styleLoader));
84
+ } else {
85
+ rule2.use("mini-css-extract-plugin").loader(require.resolve("@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader")).options({
86
+ publicPath: "./",
87
+ emit: true,
88
+ esModule: true
89
+ });
90
+ }
91
+ rule2.use("css-loader").loader(require.resolve("css-loader")).options(__spreadValues(__spreadValues({
92
+ importLoaders: 1,
93
+ esModule: true,
94
+ url: {
95
+ filter: (url) => {
96
+ if (url.startsWith("/"))
97
+ return false;
98
+ return true;
99
+ }
27
100
  },
28
- ];
29
- for (const { name, test, loader, loaderOptions } of rulesConfig) {
30
- const rule = config.module.rule(name);
31
- const nestRulesConfig = [
32
- userConfig.autoCSSModules && {
33
- rule: rule
34
- .test(test)
35
- .oneOf('css-modules')
36
- .resourceQuery(/modules/),
37
- isCSSModules: true,
38
- },
39
- {
40
- rule: rule.test(test).oneOf('css').sideEffects(true),
41
- isCSSModules: false,
42
- },
43
- ].filter(Boolean);
44
- // @ts-ignore
45
- for (const { rule, isCSSModules } of nestRulesConfig) {
46
- if (userConfig.styleLoader) {
47
- rule
48
- .use('style-loader')
49
- .loader(require.resolve('@umijs/bundler-webpack/compiled/style-loader'))
50
- .options({ base: 0, esModule: true, ...userConfig.styleLoader });
51
- }
52
- else {
53
- rule
54
- .use('mini-css-extract-plugin')
55
- .loader(require.resolve('@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader'))
56
- .options({
57
- publicPath: './',
58
- emit: true,
59
- esModule: true,
60
- });
61
- }
62
- rule
63
- .use('css-loader')
64
- .loader(require.resolve('css-loader'))
65
- .options({
66
- importLoaders: 1,
67
- esModule: true,
68
- url: {
69
- filter: (url) => {
70
- // Don't parse absolute URLs
71
- // ref: https://github.com/webpack-contrib/css-loader#url
72
- if (url.startsWith('/'))
73
- return false;
74
- return true;
75
- },
76
- },
77
- import: true,
78
- ...(isCSSModules
79
- ? {
80
- modules: {
81
- localIdentName: '[local]___[hash:base64:5]',
82
- ...userConfig.cssLoaderModules,
83
- // If SSR is enabled, we need to handling the css modules name hashing
84
- // and save the class names mapping into opts.cssModulesMapping
85
- // so the esbuild can use it to generate the correct name for the server side
86
- getLocalIdent: userConfig.ssr &&
87
- ((context, localIdentName, localName, opt) => {
88
- const classIdent = ((0, utils_1.winPath)(context.resourcePath).replace((0, utils_1.winPath)(ensureLastSlash(opt.context)), '') +
89
- '@' +
90
- localName).trim();
91
- let hash = Buffer.from(classIdent)
92
- .toString('base64')
93
- .replace(/=/g, '');
94
- hash = hash.substring(hash.length - 5);
95
- const result = localIdentName
96
- .replace(/\[local]/g, localName)
97
- .replace(/\[hash[^\[]*?]/g, hash);
98
- return result;
99
- }),
100
- },
101
- }
102
- : {}),
103
- ...userConfig.cssLoader,
104
- });
105
- rule
106
- .use('postcss-loader')
107
- .loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader'))
108
- .options({
109
- postcssOptions: {
110
- ident: 'postcss',
111
- plugins: [
112
- require('@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes'),
113
- require('postcss-preset-env')({
114
- browsers: opts.browsers,
115
- autoprefixer: {
116
- flexbox: 'no-2009',
117
- ...userConfig.autoprefixer,
118
- },
119
- stage: 3,
120
- }),
121
- ].concat(userConfig.extraPostCSSPlugins || []),
122
- ...userConfig.postcssLoader,
123
- },
124
- });
125
- if (loader) {
126
- rule
127
- .use(loader)
128
- .loader(typeof loader === 'string' ? require.resolve(loader) : loader)
129
- .options(loaderOptions || {});
130
- }
131
- }
101
+ import: true
102
+ }, isCSSModules ? {
103
+ modules: __spreadProps(__spreadValues({
104
+ localIdentName: "[local]___[hash:base64:5]"
105
+ }, userConfig.cssLoaderModules), {
106
+ getLocalIdent: userConfig.ssr && ((context, localIdentName, localName, opt) => {
107
+ const classIdent = ((0, import_utils.winPath)(context.resourcePath).replace((0, import_utils.winPath)(ensureLastSlash(opt.context)), "") + "@" + localName).trim();
108
+ let hash = Buffer.from(classIdent).toString("base64").replace(/=/g, "");
109
+ hash = hash.substring(hash.length - 5);
110
+ const result = localIdentName.replace(/\[local]/g, localName).replace(/\[hash[^\[]*?]/g, hash);
111
+ return result;
112
+ })
113
+ })
114
+ } : {}), userConfig.cssLoader));
115
+ rule2.use("postcss-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/postcss-loader")).options({
116
+ postcssOptions: __spreadValues({
117
+ ident: "postcss",
118
+ plugins: [
119
+ require("@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes"),
120
+ require("postcss-preset-env")({
121
+ browsers: opts.browsers,
122
+ autoprefixer: __spreadValues({
123
+ flexbox: "no-2009"
124
+ }, userConfig.autoprefixer),
125
+ stage: 3
126
+ })
127
+ ].concat(userConfig.extraPostCSSPlugins || [])
128
+ }, userConfig.postcssLoader)
129
+ });
130
+ if (loader) {
131
+ rule2.use(loader).loader(typeof loader === "string" ? require.resolve(loader) : loader).options(loaderOptions || {});
132
+ }
132
133
  }
134
+ }
133
135
  }
134
- exports.addCSSRules = addCSSRules;
135
136
  function ensureLastSlash(path) {
136
- return path.endsWith('/') ? path : path + '/';
137
+ return path.endsWith("/") ? path : path + "/";
137
138
  }
139
+ // Annotate the CommonJS export names for ESM import in node:
140
+ 0 && (module.exports = {
141
+ addCSSRules
142
+ });
@@ -8,6 +8,7 @@ interface IOpts {
8
8
  }
9
9
  export declare function resolveDefine(opts: {
10
10
  define: any;
11
+ publicPath?: string;
11
12
  }): {
12
13
  'process.env': Record<string, any>;
13
14
  };
@@ -1,37 +1,77 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addDefinePlugin = exports.resolveDefine = void 0;
4
- const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
5
- const prefixRE = /^UMI_APP_/;
6
- const ENV_SHOULD_PASS = ['NODE_ENV', 'HMR', 'SOCKET_SERVER', 'ERROR_OVERLAY'];
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // definePlugin.ts
34
+ var definePlugin_exports = {};
35
+ __export(definePlugin_exports, {
36
+ addDefinePlugin: () => addDefinePlugin,
37
+ resolveDefine: () => resolveDefine
38
+ });
39
+ module.exports = __toCommonJS(definePlugin_exports);
40
+ var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
41
+ var prefixRE = /^UMI_APP_/;
42
+ var ENV_SHOULD_PASS = ["NODE_ENV", "HMR", "SOCKET_SERVER", "ERROR_OVERLAY"];
7
43
  function resolveDefine(opts) {
8
- const env = {};
9
- Object.keys(process.env).forEach((key) => {
10
- if (prefixRE.test(key) || ENV_SHOULD_PASS.includes(key)) {
11
- env[key] = process.env[key];
12
- }
13
- });
14
- for (const key in env) {
15
- env[key] = JSON.stringify(env[key]);
44
+ const env = {};
45
+ Object.keys(process.env).forEach((key) => {
46
+ if (prefixRE.test(key) || ENV_SHOULD_PASS.includes(key)) {
47
+ env[key] = process.env[key];
16
48
  }
17
- const define = {};
18
- if (opts.define) {
19
- for (const key in opts.define) {
20
- define[key] = JSON.stringify(opts.define[key]);
21
- }
49
+ });
50
+ env.PUBLIC_PATH = opts.publicPath || "/";
51
+ for (const key in env) {
52
+ env[key] = JSON.stringify(env[key]);
53
+ }
54
+ const define = {};
55
+ if (opts.define) {
56
+ for (const key in opts.define) {
57
+ define[key] = JSON.stringify(opts.define[key]);
22
58
  }
23
- return {
24
- 'process.env': env,
25
- ...define,
26
- };
59
+ }
60
+ return __spreadValues({
61
+ "process.env": env
62
+ }, define);
27
63
  }
28
- exports.resolveDefine = resolveDefine;
29
64
  async function addDefinePlugin(opts) {
30
- const { config, userConfig } = opts;
31
- config.plugin('define').use(webpack_1.DefinePlugin, [
32
- resolveDefine({
33
- define: userConfig.define || {},
34
- }),
35
- ]);
65
+ const { config, userConfig } = opts;
66
+ config.plugin("define").use(import_webpack.DefinePlugin, [
67
+ resolveDefine({
68
+ define: userConfig.define || {},
69
+ publicPath: userConfig.publicPath
70
+ })
71
+ ]);
36
72
  }
37
- exports.addDefinePlugin = addDefinePlugin;
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ addDefinePlugin,
76
+ resolveDefine
77
+ });