@umijs/bundler-webpack 4.0.0-rc.13 → 4.0.0-rc.16
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/client/client/client.js +15 -7
- package/dist/build.js +48 -58
- package/dist/cli.js +6 -15
- package/dist/client/client.js +48 -53
- package/dist/config/_sampleFeature.js +6 -17
- package/dist/config/assetRules.js +44 -55
- package/dist/config/bundleAnalyzerPlugin.js +12 -23
- package/dist/config/compressPlugin.js +68 -76
- package/dist/config/config.d.ts +1 -0
- package/dist/config/config.js +177 -184
- package/dist/config/copyPlugin.js +29 -40
- package/dist/config/cssRules.js +93 -83
- package/dist/config/definePlugin.js +11 -19
- package/dist/config/detectDeadCodePlugin.js +16 -21
- package/dist/config/fastRefreshPlugin.js +11 -22
- package/dist/config/forkTSCheckerPlugin.js +11 -22
- package/dist/config/harmonyLinkingErrorPlugin.js +3 -14
- package/dist/config/ignorePlugin.js +10 -21
- package/dist/config/javaScriptRules.d.ts +1 -0
- package/dist/config/javaScriptRules.js +149 -136
- package/dist/config/manifestPlugin.js +10 -18
- package/dist/config/miniCSSExtractPlugin.js +12 -23
- package/dist/config/nodePolyfill.js +14 -20
- package/dist/config/nodePrefixPlugin.js +8 -19
- package/dist/config/progressPlugin.js +7 -18
- package/dist/config/purgecssWebpackPlugin.js +15 -26
- package/dist/config/speedMeasureWebpackPlugin.js +12 -23
- package/dist/config/svgRules.js +43 -47
- package/dist/dev.js +103 -100
- package/dist/loader/svgr.js +4 -13
- package/dist/loader/swc.js +9 -14
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +23 -34
- package/dist/plugins/ParcelCSSMinifyPlugin.js +30 -32
- package/dist/plugins/RuntimePublicPathPlugin.js +1 -1
- package/dist/schema.js +19 -6
- package/dist/server/server.d.ts +1 -1
- package/dist/server/server.js +161 -182
- package/dist/server/ws.d.ts +3 -1
- package/dist/types.d.ts +3 -6
- package/package.json +10 -10
- package/dist/server/https.d.ts +0 -5
- package/dist/server/https.js +0 -73
package/dist/config/cssRules.js
CHANGED
|
@@ -1,98 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.addCSSRules = void 0;
|
|
13
|
-
function addCSSRules(opts) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
async function addCSSRules(opts) {
|
|
5
|
+
const { config, userConfig } = opts;
|
|
6
|
+
const rulesConfig = [
|
|
7
|
+
{ name: 'css', test: /\.css(\?.*)?$/ },
|
|
8
|
+
{
|
|
9
|
+
name: 'less',
|
|
10
|
+
test: /\.less(\?.*)?$/,
|
|
11
|
+
loader: require.resolve('@umijs/bundler-webpack/compiled/less-loader'),
|
|
12
|
+
loaderOptions: {
|
|
13
|
+
implementation: require.resolve('@umijs/bundler-utils/compiled/less'),
|
|
14
|
+
lessOptions: {
|
|
15
|
+
modifyVars: userConfig.theme,
|
|
16
|
+
javascriptEnabled: true,
|
|
17
|
+
...userConfig.lessLoader,
|
|
25
18
|
},
|
|
26
19
|
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'sass',
|
|
23
|
+
test: /\.(sass|scss)(\?.*)?$/,
|
|
24
|
+
loader: require.resolve('@umijs/bundler-webpack/compiled/sass-loader'),
|
|
25
|
+
loaderOptions: userConfig.sassLoader || {},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
for (const { name, test, loader, loaderOptions } of rulesConfig) {
|
|
29
|
+
const rule = config.module.rule(name);
|
|
30
|
+
const nestRulesConfig = [
|
|
31
|
+
userConfig.autoCSSModules && {
|
|
32
|
+
rule: rule
|
|
33
|
+
.test(test)
|
|
34
|
+
.oneOf('css-modules')
|
|
35
|
+
.resourceQuery(/modules/),
|
|
36
|
+
isCSSModules: true,
|
|
37
|
+
},
|
|
27
38
|
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
loader: require.resolve('@umijs/bundler-webpack/compiled/sass-loader'),
|
|
31
|
-
loaderOptions: userConfig.sassLoader || {},
|
|
39
|
+
rule: rule.test(test).oneOf('css').sideEffects(true),
|
|
40
|
+
isCSSModules: false,
|
|
32
41
|
},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
userConfig.autoCSSModules && {
|
|
38
|
-
rule: rule
|
|
39
|
-
.test(test)
|
|
40
|
-
.oneOf('css-modules')
|
|
41
|
-
.resourceQuery(/modules/),
|
|
42
|
-
isCSSModules: true,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
rule: rule.test(test).oneOf('css').sideEffects(true),
|
|
46
|
-
isCSSModules: false,
|
|
47
|
-
},
|
|
48
|
-
].filter(Boolean);
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
for (const { rule, isCSSModules } of nestRulesConfig) {
|
|
51
|
-
if (userConfig.styleLoader) {
|
|
52
|
-
rule
|
|
53
|
-
.use('style-loader')
|
|
54
|
-
.loader(require.resolve('@umijs/bundler-webpack/compiled/style-loader'))
|
|
55
|
-
.options(Object.assign({ base: 0, esModule: true }, userConfig.styleLoader));
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
rule
|
|
59
|
-
.use('mini-css-extract-plugin')
|
|
60
|
-
.loader(require.resolve('@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader'))
|
|
61
|
-
.options({
|
|
62
|
-
publicPath: './',
|
|
63
|
-
emit: true,
|
|
64
|
-
esModule: true,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
42
|
+
].filter(Boolean);
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
for (const { rule, isCSSModules } of nestRulesConfig) {
|
|
45
|
+
if (userConfig.styleLoader) {
|
|
67
46
|
rule
|
|
68
|
-
.use('
|
|
69
|
-
.loader(require.resolve('
|
|
70
|
-
.options(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
: {})), userConfig.cssLoader));
|
|
47
|
+
.use('style-loader')
|
|
48
|
+
.loader(require.resolve('@umijs/bundler-webpack/compiled/style-loader'))
|
|
49
|
+
.options({ base: 0, esModule: true, ...userConfig.styleLoader });
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
75
52
|
rule
|
|
76
|
-
.use('
|
|
77
|
-
.loader(require.resolve('@umijs/bundler-webpack/compiled/
|
|
53
|
+
.use('mini-css-extract-plugin')
|
|
54
|
+
.loader(require.resolve('@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader'))
|
|
78
55
|
.options({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
browsers: opts.browsers,
|
|
83
|
-
autoprefixer: Object.assign({ flexbox: 'no-2009' }, userConfig.autoprefixer),
|
|
84
|
-
stage: 3,
|
|
85
|
-
}),
|
|
86
|
-
].concat(userConfig.extraPostCSSPlugins || []) }, userConfig.postcssLoader),
|
|
56
|
+
publicPath: './',
|
|
57
|
+
emit: true,
|
|
58
|
+
esModule: true,
|
|
87
59
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
60
|
+
}
|
|
61
|
+
rule
|
|
62
|
+
.use('css-loader')
|
|
63
|
+
.loader(require.resolve('css-loader'))
|
|
64
|
+
.options({
|
|
65
|
+
importLoaders: 1,
|
|
66
|
+
esModule: true,
|
|
67
|
+
url: true,
|
|
68
|
+
import: true,
|
|
69
|
+
...(isCSSModules
|
|
70
|
+
? {
|
|
71
|
+
modules: {
|
|
72
|
+
localIdentName: '[local]___[hash:base64:5]',
|
|
73
|
+
...userConfig.cssLoaderModules,
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
: {}),
|
|
77
|
+
...userConfig.cssLoader,
|
|
78
|
+
});
|
|
79
|
+
rule
|
|
80
|
+
.use('postcss-loader')
|
|
81
|
+
.loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader'))
|
|
82
|
+
.options({
|
|
83
|
+
postcssOptions: {
|
|
84
|
+
ident: 'postcss',
|
|
85
|
+
plugins: [
|
|
86
|
+
require('@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes'),
|
|
87
|
+
require('postcss-preset-env')({
|
|
88
|
+
browsers: opts.browsers,
|
|
89
|
+
autoprefixer: {
|
|
90
|
+
flexbox: 'no-2009',
|
|
91
|
+
...userConfig.autoprefixer,
|
|
92
|
+
},
|
|
93
|
+
stage: 3,
|
|
94
|
+
}),
|
|
95
|
+
].concat(userConfig.extraPostCSSPlugins || []),
|
|
96
|
+
...userConfig.postcssLoader,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
if (loader) {
|
|
100
|
+
rule
|
|
101
|
+
.use(loader)
|
|
102
|
+
.loader(typeof loader === 'string' ? require.resolve(loader) : loader)
|
|
103
|
+
.options(loaderOptions || {});
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
|
-
}
|
|
106
|
+
}
|
|
97
107
|
}
|
|
98
108
|
exports.addCSSRules = addCSSRules;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.addDefinePlugin = exports.resolveDefine = void 0;
|
|
13
4
|
const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
|
|
@@ -29,17 +20,18 @@ function resolveDefine(opts) {
|
|
|
29
20
|
define[key] = JSON.stringify(opts.define[key]);
|
|
30
21
|
}
|
|
31
22
|
}
|
|
32
|
-
return
|
|
23
|
+
return {
|
|
24
|
+
'process.env': env,
|
|
25
|
+
...define,
|
|
26
|
+
};
|
|
33
27
|
}
|
|
34
28
|
exports.resolveDefine = resolveDefine;
|
|
35
|
-
function addDefinePlugin(opts) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]);
|
|
43
|
-
});
|
|
29
|
+
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
|
+
]);
|
|
44
36
|
}
|
|
45
37
|
exports.addDefinePlugin = addDefinePlugin;
|
|
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
26
|
exports.addDetectDeadCodePlugin = void 0;
|
|
36
27
|
const types_1 = require("../types");
|
|
@@ -52,24 +43,28 @@ class DetectDeadCodePlugin {
|
|
|
52
43
|
if (!options) {
|
|
53
44
|
return;
|
|
54
45
|
}
|
|
55
|
-
this.options =
|
|
46
|
+
this.options = {
|
|
47
|
+
...this.options,
|
|
48
|
+
...options,
|
|
49
|
+
};
|
|
56
50
|
}
|
|
57
51
|
apply(compiler) {
|
|
58
52
|
if (!this.options.context) {
|
|
59
|
-
this.options =
|
|
53
|
+
this.options = {
|
|
54
|
+
...this.options,
|
|
55
|
+
context: compiler.context,
|
|
56
|
+
};
|
|
60
57
|
}
|
|
61
58
|
compiler.hooks.afterEmit.tapAsync('DetectDeadCodePlugin', this.handleAfterEmit);
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
|
-
function addDetectDeadCodePlugin(opts) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
});
|
|
61
|
+
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
|
+
}
|
|
74
69
|
}
|
|
75
70
|
exports.addDetectDeadCodePlugin = addDetectDeadCodePlugin;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -17,18 +8,16 @@ exports.addFastRefreshPlugin = void 0;
|
|
|
17
8
|
const lib_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin/lib"));
|
|
18
9
|
const constants_1 = require("../constants");
|
|
19
10
|
const types_1 = require("../types");
|
|
20
|
-
function addFastRefreshPlugin(opts) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
});
|
|
11
|
+
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
|
+
}
|
|
33
22
|
}
|
|
34
23
|
exports.addFastRefreshPlugin = addFastRefreshPlugin;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -15,20 +6,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
6
|
exports.addForkTSCheckerPlugin = void 0;
|
|
16
7
|
// @ts-ignore
|
|
17
8
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("@umijs/bundler-webpack/compiled/fork-ts-checker-webpack-plugin"));
|
|
18
|
-
function addForkTSCheckerPlugin(opts) {
|
|
9
|
+
async function addForkTSCheckerPlugin(opts) {
|
|
19
10
|
var _a;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
require.resolve('typescript');
|
|
27
|
-
}
|
|
28
|
-
config
|
|
29
|
-
.plugin('fork-ts-checker-plugin')
|
|
30
|
-
.use(fork_ts_checker_webpack_plugin_1.default, [userConfig.forkTSChecker]);
|
|
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');
|
|
31
17
|
}
|
|
32
|
-
|
|
18
|
+
config
|
|
19
|
+
.plugin('fork-ts-checker-plugin')
|
|
20
|
+
.use(fork_ts_checker_webpack_plugin_1.default, [userConfig.forkTSChecker]);
|
|
21
|
+
}
|
|
33
22
|
}
|
|
34
23
|
exports.addForkTSCheckerPlugin = addForkTSCheckerPlugin;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.addHarmonyLinkingErrorPlugin = void 0;
|
|
13
4
|
// ref: https://github.com/webpack/webpack/blob/ccecc17c01af96edddb931a76e7a3b21ef2969d8/lib/dependencies/HarmonyImportDependency.js#L164
|
|
@@ -33,10 +24,8 @@ class HarmonyLinkingErrorPlugin {
|
|
|
33
24
|
});
|
|
34
25
|
}
|
|
35
26
|
}
|
|
36
|
-
function addHarmonyLinkingErrorPlugin(opts) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
config.plugin('harmony-linking-error-plugin').use(HarmonyLinkingErrorPlugin);
|
|
40
|
-
});
|
|
27
|
+
async function addHarmonyLinkingErrorPlugin(opts) {
|
|
28
|
+
const { config } = opts;
|
|
29
|
+
config.plugin('harmony-linking-error-plugin').use(HarmonyLinkingErrorPlugin);
|
|
41
30
|
}
|
|
42
31
|
exports.addHarmonyLinkingErrorPlugin = addHarmonyLinkingErrorPlugin;
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.addIgnorePlugin = void 0;
|
|
13
4
|
const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
|
|
14
|
-
function addIgnorePlugin(opts) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
});
|
|
5
|
+
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
|
+
}
|
|
26
15
|
}
|
|
27
16
|
exports.addIgnorePlugin = addIgnorePlugin;
|