@umijs/bundler-webpack 4.0.6 → 4.0.9

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 (69) hide show
  1. package/{dist → client}/client/client.d.ts +0 -0
  2. package/client/client/client.js +295 -194
  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 +59 -40
  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 +147 -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.js +22 -20
  40. package/dist/loader/svgr.js +73 -54
  41. package/dist/loader/swc.js +110 -69
  42. package/dist/parcelCSS.js +31 -27
  43. package/dist/plugins/ProgressPlugin.js +66 -43
  44. package/dist/plugins/RuntimePublicPathPlugin.js +42 -23
  45. package/dist/plugins/_SamplePlugin.js +39 -14
  46. package/dist/requireHook.js +37 -27
  47. package/dist/schema.js +120 -95
  48. package/dist/server/server.d.ts +0 -1
  49. package/dist/server/server.js +214 -184
  50. package/dist/server/ws.d.ts +0 -2
  51. package/dist/server/ws.js +63 -38
  52. package/dist/swcPlugins/autoCSSModules.js +50 -31
  53. package/dist/swcPlugins/changeImportFromString.js +31 -9
  54. package/dist/swcPlugins/lockCoreJS.js +44 -20
  55. package/dist/types.d.ts +2 -1
  56. package/dist/types.js +61 -30
  57. package/dist/utils/browsersList.js +31 -8
  58. package/dist/utils/depMatch.js +63 -39
  59. package/dist/utils/formatWebpackMessages.js +93 -91
  60. package/dist/utils/getEsBuildTarget.js +32 -10
  61. package/package.json +12 -16
  62. package/compiled/fork-ts-checker-webpack-plugin/LICENSE +0 -21
  63. package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
  64. package/compiled/fork-ts-checker-webpack-plugin/index.js +0 -42
  65. package/compiled/fork-ts-checker-webpack-plugin/package.json +0 -1
  66. package/compiled/react-refresh/LICENSE +0 -21
  67. package/compiled/react-refresh/index.js +0 -21
  68. package/compiled/react-refresh/package.json +0 -1
  69. package/dist/client/client.js +0 -245
@@ -1,70 +1,85 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
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]);
7
20
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
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 });
24
27
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.addDetectDeadCodePlugin = void 0;
27
- const types_1 = require("../types");
28
- const detectDeadCode_1 = __importStar(require("./detectDeadCode"));
29
- const defaultOptions = {
30
- patterns: [`!(${detectDeadCode_1.disabledFolders.join('|')})/**/*.*`],
31
- exclude: [],
32
- failOnHint: false,
33
- detectUnusedFiles: true,
34
- detectUnusedExport: true,
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
+ // detectDeadCodePlugin.ts
40
+ var detectDeadCodePlugin_exports = {};
41
+ __export(detectDeadCodePlugin_exports, {
42
+ addDetectDeadCodePlugin: () => addDetectDeadCodePlugin
43
+ });
44
+ module.exports = __toCommonJS(detectDeadCodePlugin_exports);
45
+ var import_types = require("../types");
46
+ var import_detectDeadCode = __toESM(require("./detectDeadCode"));
47
+ var defaultOptions = {
48
+ patterns: [`!(${import_detectDeadCode.disabledFolders.join("|")})/**/*.*`],
49
+ exclude: [],
50
+ failOnHint: false,
51
+ detectUnusedFiles: true,
52
+ detectUnusedExport: true
35
53
  };
36
- class DetectDeadCodePlugin {
37
- constructor(options) {
38
- this.options = defaultOptions;
39
- this.handleAfterEmit = (compilation, callback) => {
40
- (0, detectDeadCode_1.default)(compilation, this.options);
41
- callback();
42
- };
43
- if (!options) {
44
- return;
45
- }
46
- this.options = {
47
- ...this.options,
48
- ...options,
49
- };
54
+ var DetectDeadCodePlugin = class {
55
+ constructor(options) {
56
+ this.options = defaultOptions;
57
+ this.handleAfterEmit = (compilation, callback) => {
58
+ (0, import_detectDeadCode.default)(compilation, this.options);
59
+ callback();
60
+ };
61
+ if (!options) {
62
+ return;
50
63
  }
51
- apply(compiler) {
52
- if (!this.options.context) {
53
- this.options = {
54
- ...this.options,
55
- context: compiler.context,
56
- };
57
- }
58
- compiler.hooks.afterEmit.tapAsync('DetectDeadCodePlugin', this.handleAfterEmit);
64
+ this.options = __spreadValues(__spreadValues({}, this.options), options);
65
+ }
66
+ apply(compiler) {
67
+ if (!this.options.context) {
68
+ this.options = __spreadProps(__spreadValues({}, this.options), {
69
+ context: compiler.context
70
+ });
59
71
  }
60
- }
72
+ compiler.hooks.afterEmit.tapAsync("DetectDeadCodePlugin", this.handleAfterEmit);
73
+ }
74
+ };
61
75
  async function addDetectDeadCodePlugin(opts) {
62
- const { config, userConfig } = opts;
63
- const isDev = opts.env === types_1.Env.development;
64
- if (userConfig.deadCode && !isDev) {
65
- config
66
- .plugin('detect-dead-code-plugin')
67
- .use(DetectDeadCodePlugin, [userConfig.deadCode]);
68
- }
76
+ const { config, userConfig } = opts;
77
+ const isDev = opts.env === import_types.Env.development;
78
+ if (userConfig.deadCode && !isDev) {
79
+ config.plugin("detect-dead-code-plugin").use(DetectDeadCodePlugin, [userConfig.deadCode]);
80
+ }
69
81
  }
70
- exports.addDetectDeadCodePlugin = addDetectDeadCodePlugin;
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ addDetectDeadCodePlugin
85
+ });
@@ -1,23 +1,42 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
4
10
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.addFastRefreshPlugin = void 0;
7
- // @ts-ignore
8
- const lib_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin/lib"));
9
- const constants_1 = require("../constants");
10
- const types_1 = require("../types");
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ 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));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // fastRefreshPlugin.ts
23
+ var fastRefreshPlugin_exports = {};
24
+ __export(fastRefreshPlugin_exports, {
25
+ addFastRefreshPlugin: () => addFastRefreshPlugin
26
+ });
27
+ module.exports = __toCommonJS(fastRefreshPlugin_exports);
28
+ var import_lib = __toESM(require("@pmmmwh/react-refresh-webpack-plugin/lib"));
29
+ var import_constants = require("../constants");
30
+ var import_types = require("../types");
11
31
  async function addFastRefreshPlugin(opts) {
12
- const { config, userConfig, name } = opts;
13
- const isDev = opts.env === types_1.Env.development;
14
- const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== constants_1.MFSU_NAME;
15
- // TODO: Should only run in react csr
16
- if (useFastRefresh) {
17
- config
18
- .plugin('fastRefresh')
19
- .after('hmr')
20
- .use(lib_1.default, [{ overlay: false }]);
21
- }
32
+ const { config, userConfig, name } = opts;
33
+ const isDev = opts.env === import_types.Env.development;
34
+ const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== import_constants.MFSU_NAME;
35
+ if (useFastRefresh) {
36
+ config.plugin("fastRefresh").after("hmr").use(import_lib.default, [{ overlay: false }]);
37
+ }
22
38
  }
23
- exports.addFastRefreshPlugin = addFastRefreshPlugin;
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ addFastRefreshPlugin
42
+ });
@@ -1,23 +1,42 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
4
10
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.addForkTSCheckerPlugin = void 0;
7
- // @ts-ignore
8
- const fork_ts_checker_webpack_plugin_1 = __importDefault(require("@umijs/bundler-webpack/compiled/fork-ts-checker-webpack-plugin"));
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ 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));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // forkTSCheckerPlugin.ts
23
+ var forkTSCheckerPlugin_exports = {};
24
+ __export(forkTSCheckerPlugin_exports, {
25
+ addForkTSCheckerPlugin: () => addForkTSCheckerPlugin
26
+ });
27
+ module.exports = __toCommonJS(forkTSCheckerPlugin_exports);
28
+ var import_fork_ts_checker_webpack_plugin = __toESM(require("fork-ts-checker-webpack-plugin"));
9
29
  async function addForkTSCheckerPlugin(opts) {
10
- var _a;
11
- const { config, userConfig } = opts;
12
- if (userConfig.forkTSChecker) {
13
- // use user's typescript
14
- if ((_a = userConfig.forkTSChecker.typescript) === null || _a === void 0 ? void 0 : _a.enable) {
15
- userConfig.forkTSChecker.typescript.typescriptPath =
16
- require.resolve('typescript');
17
- }
18
- config
19
- .plugin('fork-ts-checker-plugin')
20
- .use(fork_ts_checker_webpack_plugin_1.default, [userConfig.forkTSChecker]);
30
+ var _a;
31
+ const { config, userConfig } = opts;
32
+ if (userConfig.forkTSChecker) {
33
+ if ((_a = userConfig.forkTSChecker.typescript) == null ? void 0 : _a.enable) {
34
+ userConfig.forkTSChecker.typescript.typescriptPath = require.resolve("typescript");
21
35
  }
36
+ config.plugin("fork-ts-checker-plugin").use(import_fork_ts_checker_webpack_plugin.default, [userConfig.forkTSChecker]);
37
+ }
22
38
  }
23
- exports.addForkTSCheckerPlugin = addForkTSCheckerPlugin;
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ addForkTSCheckerPlugin
42
+ });
@@ -1,31 +1,50 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addHarmonyLinkingErrorPlugin = void 0;
4
- // ref: https://github.com/webpack/webpack/blob/ccecc17c01af96edddb931a76e7a3b21ef2969d8/lib/dependencies/HarmonyImportDependency.js#L164
5
- const LINKING_ERROR_TAG = 'was not found in';
6
- // build 时会出现 css modules 的引用警告,但这应该是需要忽略的
7
- const CSS_NO_EXPORTS = /\.(css|sass|scss|styl|less)' \(module has no exports\)/;
8
- class HarmonyLinkingErrorPlugin {
9
- apply(compiler) {
10
- compiler.hooks.afterCompile.tap('HarmonyLinkingErrorPlugin', (compilation) => {
11
- if (!compilation.warnings.length) {
12
- return;
13
- }
14
- const harmonyLinkingErrors = compilation.warnings.filter((w) => {
15
- return (w.name === 'ModuleDependencyWarning' &&
16
- !w.module.resource.includes('node_modules') &&
17
- w.message.includes(LINKING_ERROR_TAG) &&
18
- !CSS_NO_EXPORTS.test(w.message));
19
- });
20
- if (!harmonyLinkingErrors.length) {
21
- return;
22
- }
23
- compilation.errors.push(...harmonyLinkingErrors);
24
- });
25
- }
26
- }
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
+ // harmonyLinkingErrorPlugin.ts
20
+ var harmonyLinkingErrorPlugin_exports = {};
21
+ __export(harmonyLinkingErrorPlugin_exports, {
22
+ addHarmonyLinkingErrorPlugin: () => addHarmonyLinkingErrorPlugin
23
+ });
24
+ module.exports = __toCommonJS(harmonyLinkingErrorPlugin_exports);
25
+ var LINKING_ERROR_TAG = "was not found in";
26
+ var CSS_NO_EXPORTS = /\.(css|sass|scss|styl|less)' \(module has no exports\)/;
27
+ var HarmonyLinkingErrorPlugin = class {
28
+ apply(compiler) {
29
+ compiler.hooks.afterCompile.tap("HarmonyLinkingErrorPlugin", (compilation) => {
30
+ if (!compilation.warnings.length) {
31
+ return;
32
+ }
33
+ const harmonyLinkingErrors = compilation.warnings.filter((w) => {
34
+ return w.name === "ModuleDependencyWarning" && !w.module.resource.includes("node_modules") && w.message.includes(LINKING_ERROR_TAG) && !CSS_NO_EXPORTS.test(w.message);
35
+ });
36
+ if (!harmonyLinkingErrors.length) {
37
+ return;
38
+ }
39
+ compilation.errors.push(...harmonyLinkingErrors);
40
+ });
41
+ }
42
+ };
27
43
  async function addHarmonyLinkingErrorPlugin(opts) {
28
- const { config } = opts;
29
- config.plugin('harmony-linking-error-plugin').use(HarmonyLinkingErrorPlugin);
44
+ const { config } = opts;
45
+ config.plugin("harmony-linking-error-plugin").use(HarmonyLinkingErrorPlugin);
30
46
  }
31
- exports.addHarmonyLinkingErrorPlugin = addHarmonyLinkingErrorPlugin;
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ addHarmonyLinkingErrorPlugin
50
+ });
@@ -1,16 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addIgnorePlugin = void 0;
4
- const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
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
+ // ignorePlugin.ts
20
+ var ignorePlugin_exports = {};
21
+ __export(ignorePlugin_exports, {
22
+ addIgnorePlugin: () => addIgnorePlugin
23
+ });
24
+ module.exports = __toCommonJS(ignorePlugin_exports);
25
+ var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
5
26
  async function addIgnorePlugin(opts) {
6
- const { config, userConfig } = opts;
7
- if (userConfig.ignoreMomentLocale) {
8
- config.plugin('ignore-moment-locale').use(webpack_1.IgnorePlugin, [
9
- {
10
- resourceRegExp: /^\.\/locale$/,
11
- contextRegExp: /moment$/,
12
- },
13
- ]);
14
- }
27
+ const { config, userConfig } = opts;
28
+ if (userConfig.ignoreMomentLocale) {
29
+ config.plugin("ignore-moment-locale").use(import_webpack.IgnorePlugin, [
30
+ {
31
+ resourceRegExp: /^\.\/locale$/,
32
+ contextRegExp: /moment$/
33
+ }
34
+ ]);
35
+ }
15
36
  }
16
- exports.addIgnorePlugin = addIgnorePlugin;
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ addIgnorePlugin
40
+ });