@umijs/bundler-webpack 4.0.0-rc.8 → 4.0.1

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 (84) hide show
  1. package/client/client/client.js +65 -37
  2. package/client/constants.js +9 -0
  3. package/compiled/babel-loader/index.js +2 -2
  4. package/compiled/copy-webpack-plugin/{576.index.js → 939.index.js} +11 -11
  5. package/compiled/copy-webpack-plugin/index.js +12 -12
  6. package/compiled/css-minimizer-webpack-plugin/index.js +7 -7
  7. package/compiled/cssnano/index.js +6 -6
  8. package/compiled/fork-ts-checker-webpack-plugin/index.js +7 -13
  9. package/compiled/{tapable → react-refresh}/LICENSE +6 -6
  10. package/compiled/react-refresh/index.js +9 -7
  11. package/compiled/react-refresh/package.json +1 -0
  12. package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
  13. package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
  14. package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
  15. package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
  16. package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
  17. package/compiled/webpack/RuleSetCompiler.js +1 -0
  18. package/compiled/webpack/UseEffectRulePlugin.js +1 -0
  19. package/compiled/webpack/deepImports.json +6 -1
  20. package/compiled/webpack/index.js +3978 -3167
  21. package/compiled/webpack/types.d.ts +606 -171
  22. package/compiled/webpack-dev-middleware/index.js +8 -7
  23. package/compiled/webpack-manifest-plugin/index.js +1 -1
  24. package/dist/build.d.ts +1 -0
  25. package/dist/build.js +49 -56
  26. package/dist/cli.js +6 -15
  27. package/dist/client/client.js +52 -50
  28. package/dist/config/_sampleFeature.js +6 -17
  29. package/dist/config/assetRules.js +44 -55
  30. package/dist/config/bundleAnalyzerPlugin.js +12 -23
  31. package/dist/config/compressPlugin.js +89 -70
  32. package/dist/config/config.d.ts +2 -0
  33. package/dist/config/config.js +181 -179
  34. package/dist/config/copyPlugin.js +29 -40
  35. package/dist/config/cssRules.js +114 -83
  36. package/dist/config/definePlugin.js +11 -19
  37. package/dist/config/detectDeadCodePlugin.js +16 -21
  38. package/dist/config/fastRefreshPlugin.js +11 -22
  39. package/dist/config/forkTSCheckerPlugin.js +11 -22
  40. package/dist/config/harmonyLinkingErrorPlugin.js +3 -14
  41. package/dist/config/ignorePlugin.js +10 -21
  42. package/dist/config/javaScriptRules.d.ts +1 -0
  43. package/dist/config/javaScriptRules.js +152 -135
  44. package/dist/config/manifestPlugin.d.ts +1 -1
  45. package/dist/config/manifestPlugin.js +10 -18
  46. package/dist/config/miniCSSExtractPlugin.js +15 -23
  47. package/dist/config/nodePolyfill.js +14 -20
  48. package/dist/config/nodePrefixPlugin.d.ts +11 -0
  49. package/dist/config/nodePrefixPlugin.js +14 -0
  50. package/dist/config/progressPlugin.js +7 -18
  51. package/dist/config/purgecssWebpackPlugin.js +15 -26
  52. package/dist/config/speedMeasureWebpackPlugin.js +12 -23
  53. package/dist/config/ssrPlugin.d.ts +11 -0
  54. package/dist/config/ssrPlugin.js +66 -0
  55. package/dist/config/svgRules.js +44 -47
  56. package/dist/constants.d.ts +1 -0
  57. package/dist/constants.js +7 -1
  58. package/dist/dev.d.ts +4 -0
  59. package/dist/dev.js +115 -94
  60. package/dist/index.d.ts +3 -0
  61. package/dist/index.js +16 -0
  62. package/dist/loader/svgr.js +4 -13
  63. package/dist/loader/swc.js +9 -14
  64. package/dist/plugins/ProgressPlugin.js +3 -3
  65. package/dist/plugins/RuntimePublicPathPlugin.js +4 -1
  66. package/dist/schema.js +24 -8
  67. package/dist/server/server.d.ts +3 -1
  68. package/dist/server/server.js +165 -150
  69. package/dist/server/ws.d.ts +7 -2
  70. package/dist/swcPlugins/autoCSSModules.js +3 -1
  71. package/dist/swcPlugins/changeImportFromString.d.ts +2 -0
  72. package/dist/swcPlugins/changeImportFromString.js +10 -0
  73. package/dist/swcPlugins/lockCoreJS.js +3 -2
  74. package/dist/types.d.ts +3 -0
  75. package/dist/utils/getEsBuildTarget.d.ts +5 -0
  76. package/dist/utils/getEsBuildTarget.js +12 -0
  77. package/package.json +23 -21
  78. package/compiled/tapable/index.js +0 -1
  79. package/compiled/tapable/package.json +0 -1
  80. package/compiled/tapable/tapable.d.ts +0 -116
  81. package/dist/plugins/ESBuildCSSMinifyPlugin.d.ts +0 -11
  82. package/dist/plugins/ESBuildCSSMinifyPlugin.js +0 -63
  83. package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +0 -10
  84. package/dist/plugins/ParcelCSSMinifyPlugin.js +0 -75
@@ -1,98 +1,129 @@
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
- return __awaiter(this, void 0, void 0, function* () {
15
- const { config, userConfig } = opts;
16
- const rulesConfig = [
17
- { name: 'css', test: /\.css(\?.*)?$/ },
18
- {
19
- name: 'less',
20
- test: /\.less(\?.*)?$/,
21
- loader: require.resolve('@umijs/bundler-webpack/compiled/less-loader'),
22
- loaderOptions: {
23
- implementation: require.resolve('@umijs/bundler-utils/compiled/less'),
24
- lessOptions: Object.assign({ modifyVars: userConfig.theme, javascriptEnabled: true }, userConfig.lessLoader),
4
+ const utils_1 = require("@umijs/utils");
5
+ 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,
25
19
  },
26
20
  },
21
+ },
22
+ {
23
+ name: 'sass',
24
+ test: /\.(sass|scss)(\?.*)?$/,
25
+ loader: require.resolve('@umijs/bundler-webpack/compiled/sass-loader'),
26
+ loaderOptions: userConfig.sassLoader || {},
27
+ },
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
+ },
27
39
  {
28
- name: 'sass',
29
- test: /\.(sass|scss)(\?.*)?$/,
30
- loader: require.resolve('@umijs/bundler-webpack/compiled/sass-loader'),
31
- loaderOptions: userConfig.sassLoader || {},
40
+ rule: rule.test(test).oneOf('css').sideEffects(true),
41
+ isCSSModules: false,
32
42
  },
33
- ];
34
- for (const { name, test, loader, loaderOptions } of rulesConfig) {
35
- const rule = config.module.rule(name);
36
- const nestRulesConfig = [
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
- }
43
+ ].filter(Boolean);
44
+ // @ts-ignore
45
+ for (const { rule, isCSSModules } of nestRulesConfig) {
46
+ if (userConfig.styleLoader) {
67
47
  rule
68
- .use('css-loader')
69
- .loader(require.resolve('css-loader'))
70
- .options(Object.assign(Object.assign({ importLoaders: 1, esModule: true, url: true, import: true }, (isCSSModules
71
- ? {
72
- modules: Object.assign({ localIdentName: '[local]___[hash:base64:5]' }, userConfig.cssLoaderModules),
73
- }
74
- : {})), userConfig.cssLoader));
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 {
75
53
  rule
76
- .use('postcss-loader')
77
- .loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader'))
54
+ .use('mini-css-extract-plugin')
55
+ .loader(require.resolve('@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader'))
78
56
  .options({
79
- postcssOptions: Object.assign({ ident: 'postcss', plugins: [
80
- require('@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes'),
81
- require('postcss-preset-env')({
82
- browsers: opts.browsers,
83
- autoprefixer: Object.assign({ flexbox: 'no-2009' }, userConfig.autoprefixer),
84
- stage: 3,
85
- }),
86
- ].concat(userConfig.extraPostCSSPlugins || []) }, userConfig.postcssLoader),
57
+ publicPath: './',
58
+ emit: true,
59
+ esModule: true,
87
60
  });
88
- if (loader) {
89
- rule
90
- .use(loader)
91
- .loader(typeof loader === 'string' ? require.resolve(loader) : loader)
92
- .options(loaderOptions || {});
93
- }
61
+ }
62
+ rule
63
+ .use('css-loader')
64
+ .loader(require.resolve('css-loader'))
65
+ .options({
66
+ importLoaders: 1,
67
+ esModule: true,
68
+ url: true,
69
+ import: true,
70
+ ...(isCSSModules
71
+ ? {
72
+ modules: {
73
+ localIdentName: '[local]___[hash:base64:5]',
74
+ ...userConfig.cssLoaderModules,
75
+ // If SSR is enabled, we need to handling the css modules name hashing
76
+ // and save the class names mapping into opts.cssModulesMapping
77
+ // so the esbuild can use it to generate the correct name for the server side
78
+ getLocalIdent: userConfig.ssr &&
79
+ ((context, localIdentName, localName, opt) => {
80
+ const classIdent = ((0, utils_1.winPath)(context.resourcePath).replace((0, utils_1.winPath)(ensureLastSlash(opt.context)), '') +
81
+ '@' +
82
+ localName).trim();
83
+ let hash = Buffer.from(classIdent)
84
+ .toString('base64')
85
+ .replace(/=/g, '');
86
+ hash = hash.substring(hash.length - 5);
87
+ const result = localIdentName
88
+ .replace(/\[local]/g, localName)
89
+ .replace(/\[hash[^\[]*?]/g, hash);
90
+ return result;
91
+ }),
92
+ },
93
+ }
94
+ : {}),
95
+ ...userConfig.cssLoader,
96
+ });
97
+ rule
98
+ .use('postcss-loader')
99
+ .loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader'))
100
+ .options({
101
+ postcssOptions: {
102
+ ident: 'postcss',
103
+ plugins: [
104
+ require('@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes'),
105
+ require('postcss-preset-env')({
106
+ browsers: opts.browsers,
107
+ autoprefixer: {
108
+ flexbox: 'no-2009',
109
+ ...userConfig.autoprefixer,
110
+ },
111
+ stage: 3,
112
+ }),
113
+ ].concat(userConfig.extraPostCSSPlugins || []),
114
+ ...userConfig.postcssLoader,
115
+ },
116
+ });
117
+ if (loader) {
118
+ rule
119
+ .use(loader)
120
+ .loader(typeof loader === 'string' ? require.resolve(loader) : loader)
121
+ .options(loaderOptions || {});
94
122
  }
95
123
  }
96
- });
124
+ }
97
125
  }
98
126
  exports.addCSSRules = addCSSRules;
127
+ function ensureLastSlash(path) {
128
+ return path.endsWith('/') ? path : path + '/';
129
+ }
@@ -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 Object.assign({ 'process.env': env }, define);
23
+ return {
24
+ 'process.env': env,
25
+ ...define,
26
+ };
33
27
  }
34
28
  exports.resolveDefine = resolveDefine;
35
- function addDefinePlugin(opts) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const { config, userConfig } = opts;
38
- config.plugin('define').use(webpack_1.DefinePlugin, [
39
- resolveDefine({
40
- define: userConfig.define || {},
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 = Object.assign(Object.assign({}, this.options), 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 = Object.assign(Object.assign({}, this.options), { context: compiler.context });
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
- return __awaiter(this, void 0, void 0, function* () {
66
- const { config, userConfig } = opts;
67
- const isDev = opts.env === types_1.Env.development;
68
- if (userConfig.deadCode && !isDev) {
69
- config
70
- .plugin('detect-dead-code-plugin')
71
- .use(DetectDeadCodePlugin, [userConfig.deadCode]);
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
- return __awaiter(this, void 0, void 0, function* () {
22
- const { config, userConfig, name } = opts;
23
- const isDev = opts.env === types_1.Env.development;
24
- const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== constants_1.MFSU_NAME;
25
- // TODO: Should only run in react csr
26
- if (useFastRefresh) {
27
- config
28
- .plugin('fastRefresh')
29
- .after('hmr')
30
- .use(lib_1.default, [{ overlay: false }]);
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
- return __awaiter(this, void 0, void 0, function* () {
21
- const { config, userConfig } = opts;
22
- if (userConfig.forkTSChecker) {
23
- // use user's typescript
24
- if ((_a = userConfig.forkTSChecker.typescript) === null || _a === void 0 ? void 0 : _a.enable) {
25
- userConfig.forkTSChecker.typescript.typescriptPath =
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
- return __awaiter(this, void 0, void 0, function* () {
38
- const { config } = opts;
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
- return __awaiter(this, void 0, void 0, function* () {
16
- const { config, userConfig } = opts;
17
- if (userConfig.ignoreMomentLocale) {
18
- config.plugin('ignore-moment-locale').use(webpack_1.IgnorePlugin, [
19
- {
20
- resourceRegExp: /^\.\/locale$/,
21
- contextRegExp: /moment$/,
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;
@@ -7,6 +7,7 @@ interface IOpts {
7
7
  env: Env;
8
8
  extraBabelPlugins: any[];
9
9
  extraBabelPresets: any[];
10
+ extraBabelIncludes: string[];
10
11
  extraEsbuildLoaderHandler: any[];
11
12
  babelPreset: any;
12
13
  name?: string;