@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.
- package/{dist → client}/client/client.d.ts +0 -0
- package/client/client/client.js +295 -194
- package/client/constants.d.ts +15 -0
- package/client/constants.js +28 -19
- package/client/utils/formatWebpackMessages.d.ts +12 -0
- package/client/utils/formatWebpackMessages.js +68 -86
- package/dist/build.d.ts +1 -1
- package/dist/build.js +105 -61
- package/dist/cli.js +77 -69
- package/dist/config/_sampleFeature.js +33 -9
- package/dist/config/assetRules.js +45 -36
- package/dist/config/bundleAnalyzerPlugin.js +39 -17
- package/dist/config/compressPlugin.js +113 -95
- package/dist/config/config.d.ts +1 -0
- package/dist/config/config.js +204 -215
- package/dist/config/copyPlugin.js +59 -40
- package/dist/config/cssRules.js +136 -131
- package/dist/config/definePlugin.d.ts +1 -0
- package/dist/config/definePlugin.js +71 -31
- package/dist/config/detectDeadCode.js +120 -108
- package/dist/config/detectDeadCodePlugin.js +78 -63
- package/dist/config/fastRefreshPlugin.js +39 -20
- package/dist/config/forkTSCheckerPlugin.js +38 -19
- package/dist/config/harmonyLinkingErrorPlugin.js +48 -29
- package/dist/config/ignorePlugin.js +38 -14
- package/dist/config/javaScriptRules.js +147 -173
- package/dist/config/manifestPlugin.js +51 -15
- package/dist/config/miniCSSExtractPlugin.js +42 -22
- package/dist/config/nodePolyfill.js +65 -26
- package/dist/config/nodePrefixPlugin.js +36 -12
- package/dist/config/progressPlugin.js +37 -13
- package/dist/config/purgecssWebpackPlugin.js +41 -19
- package/dist/config/speedMeasureWebpackPlugin.js +41 -20
- package/dist/config/ssrPlugin.js +83 -63
- package/dist/config/svgRules.js +74 -46
- package/dist/constants.js +57 -22
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +170 -129
- package/dist/index.js +22 -20
- package/dist/loader/svgr.js +73 -54
- package/dist/loader/swc.js +110 -69
- package/dist/parcelCSS.js +31 -27
- package/dist/plugins/ProgressPlugin.js +66 -43
- package/dist/plugins/RuntimePublicPathPlugin.js +42 -23
- package/dist/plugins/_SamplePlugin.js +39 -14
- package/dist/requireHook.js +37 -27
- package/dist/schema.js +120 -95
- package/dist/server/server.d.ts +0 -1
- package/dist/server/server.js +214 -184
- package/dist/server/ws.d.ts +0 -2
- package/dist/server/ws.js +63 -38
- package/dist/swcPlugins/autoCSSModules.js +50 -31
- package/dist/swcPlugins/changeImportFromString.js +31 -9
- package/dist/swcPlugins/lockCoreJS.js +44 -20
- package/dist/types.d.ts +2 -1
- package/dist/types.js +61 -30
- package/dist/utils/browsersList.js +31 -8
- package/dist/utils/depMatch.js +63 -39
- package/dist/utils/formatWebpackMessages.js +93 -91
- package/dist/utils/getEsBuildTarget.js +32 -10
- package/package.json +12 -16
- package/compiled/fork-ts-checker-webpack-plugin/LICENSE +0 -21
- package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
- package/compiled/fork-ts-checker-webpack-plugin/index.js +0 -42
- package/compiled/fork-ts-checker-webpack-plugin/package.json +0 -1
- package/compiled/react-refresh/LICENSE +0 -21
- package/compiled/react-refresh/index.js +0 -21
- package/compiled/react-refresh/package.json +0 -1
- package/dist/client/client.js +0 -245
|
@@ -1,70 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
addDetectDeadCodePlugin
|
|
85
|
+
});
|
|
@@ -1,23 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
addFastRefreshPlugin
|
|
42
|
+
});
|
|
@@ -1,23 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
addForkTSCheckerPlugin
|
|
42
|
+
});
|
|
@@ -1,31 +1,50 @@
|
|
|
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
|
-
|
|
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
|
-
|
|
29
|
-
|
|
44
|
+
const { config } = opts;
|
|
45
|
+
config.plugin("harmony-linking-error-plugin").use(HarmonyLinkingErrorPlugin);
|
|
30
46
|
}
|
|
31
|
-
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
addHarmonyLinkingErrorPlugin
|
|
50
|
+
});
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
addIgnorePlugin
|
|
40
|
+
});
|