@umijs/bundler-webpack 4.0.0-rc.9 → 4.0.2
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 +65 -37
- package/client/constants.js +9 -0
- package/compiled/css-minimizer-webpack-plugin/index.js +7 -7
- package/compiled/cssnano/index.js +6 -6
- package/compiled/fork-ts-checker-webpack-plugin/index.js +7 -13
- package/compiled/{tapable → react-refresh}/LICENSE +6 -6
- package/compiled/react-refresh/index.js +9 -7
- package/compiled/react-refresh/package.json +1 -0
- package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
- package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
- package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
- package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
- package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
- package/compiled/webpack/RuleSetCompiler.js +1 -0
- package/compiled/webpack/UseEffectRulePlugin.js +1 -0
- package/compiled/webpack/deepImports.json +6 -1
- package/compiled/webpack/index.js +3978 -3167
- package/compiled/webpack/types.d.ts +606 -171
- package/compiled/webpack-dev-middleware/index.js +8 -7
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/dist/build.d.ts +1 -0
- package/dist/build.js +49 -56
- package/dist/cli.js +6 -15
- package/dist/client/client.js +52 -50
- package/dist/config/_sampleFeature.js +6 -17
- package/dist/config/assetRules.js +33 -55
- package/dist/config/bundleAnalyzerPlugin.js +12 -23
- package/dist/config/compressPlugin.js +89 -70
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +182 -179
- package/dist/config/copyPlugin.js +29 -40
- package/dist/config/cssRules.js +114 -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 +152 -136
- package/dist/config/manifestPlugin.d.ts +1 -1
- package/dist/config/manifestPlugin.js +10 -18
- package/dist/config/miniCSSExtractPlugin.js +15 -23
- package/dist/config/nodePolyfill.js +14 -20
- package/dist/config/nodePrefixPlugin.d.ts +11 -0
- package/dist/config/nodePrefixPlugin.js +14 -0
- package/dist/config/progressPlugin.js +7 -18
- package/dist/config/purgecssWebpackPlugin.js +15 -26
- package/dist/config/speedMeasureWebpackPlugin.js +12 -23
- package/dist/config/ssrPlugin.d.ts +11 -0
- package/dist/config/ssrPlugin.js +66 -0
- package/dist/config/svgRules.js +35 -44
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +7 -1
- package/dist/dev.d.ts +4 -0
- package/dist/dev.js +113 -93
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -0
- package/dist/loader/svgr.js +4 -13
- package/dist/loader/swc.js +9 -14
- package/dist/plugins/ProgressPlugin.js +3 -3
- package/dist/plugins/RuntimePublicPathPlugin.js +4 -1
- package/dist/schema.d.ts +1 -2
- package/dist/schema.js +21 -6
- package/dist/server/server.d.ts +3 -1
- package/dist/server/server.js +165 -159
- package/dist/server/ws.d.ts +7 -2
- package/dist/types.d.ts +3 -0
- package/dist/utils/getEsBuildTarget.d.ts +5 -0
- package/dist/utils/getEsBuildTarget.js +12 -0
- package/package.json +23 -21
- package/compiled/tapable/index.js +0 -1
- package/compiled/tapable/package.json +0 -1
- package/compiled/tapable/tapable.d.ts +0 -116
- package/dist/plugins/ESBuildCSSMinifyPlugin.d.ts +0 -11
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +0 -63
- package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +0 -10
- package/dist/plugins/ParcelCSSMinifyPlugin.js +0 -75
package/dist/config/cssRules.js
CHANGED
|
@@ -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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
43
|
+
].filter(Boolean);
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
for (const { rule, isCSSModules } of nestRulesConfig) {
|
|
46
|
+
if (userConfig.styleLoader) {
|
|
67
47
|
rule
|
|
68
|
-
.use('
|
|
69
|
-
.loader(require.resolve('
|
|
70
|
-
.options(
|
|
71
|
-
|
|
72
|
-
|
|
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('
|
|
77
|
-
.loader(require.resolve('@umijs/bundler-webpack/compiled/
|
|
54
|
+
.use('mini-css-extract-plugin')
|
|
55
|
+
.loader(require.resolve('@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader'))
|
|
78
56
|
.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),
|
|
57
|
+
publicPath: './',
|
|
58
|
+
emit: true,
|
|
59
|
+
esModule: true,
|
|
87
60
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
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;
|