@umijs/bundler-utoopack 4.6.36 → 4.6.38
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/config.js +22 -18
- package/package.json +4 -4
package/dist/config.js
CHANGED
|
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(config_exports);
|
|
|
36
36
|
var import_bundler_webpack = require("@umijs/bundler-webpack");
|
|
37
37
|
var import_utils = require("@umijs/utils");
|
|
38
38
|
var import_pack = require("@utoo/pack");
|
|
39
|
+
var import_fs = __toESM(require("fs"));
|
|
39
40
|
var import_path = require("path");
|
|
40
41
|
function convertProcessEnvForUtoopack(webpackConfig) {
|
|
41
42
|
var _a;
|
|
@@ -103,8 +104,21 @@ function getNormalizedAlias(alias, rootDir) {
|
|
|
103
104
|
if (key.endsWith("/*") || value.endsWith("/*") || key.endsWith("/") || value.endsWith("/") || key.endsWith("$")) {
|
|
104
105
|
continue;
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
const ext = (0, import_path.extname)(value);
|
|
108
|
+
if (ext) {
|
|
109
|
+
let isDirectory = false;
|
|
110
|
+
const candidates = [.../* @__PURE__ */ new Set([value, (0, import_path.resolve)(rootDir, value)])];
|
|
111
|
+
for (const candidate of candidates) {
|
|
112
|
+
try {
|
|
113
|
+
const stat = import_fs.default.statSync(candidate);
|
|
114
|
+
if (stat.isDirectory()) {
|
|
115
|
+
isDirectory = true;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
} catch (e) {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (!isDirectory) continue;
|
|
108
122
|
}
|
|
109
123
|
newAlias[`${key}/*`] = `${value}/*`;
|
|
110
124
|
}
|
|
@@ -183,7 +197,7 @@ function getSvgModuleRules(opts) {
|
|
|
183
197
|
};
|
|
184
198
|
}
|
|
185
199
|
async function getProdUtooPackConfig(opts) {
|
|
186
|
-
var _a
|
|
200
|
+
var _a;
|
|
187
201
|
const webpackConfig = await (0, import_bundler_webpack.getConfig)({
|
|
188
202
|
cwd: opts.cwd,
|
|
189
203
|
rootDir: opts.rootDir,
|
|
@@ -228,10 +242,6 @@ async function getProdUtooPackConfig(opts) {
|
|
|
228
242
|
svgo = {},
|
|
229
243
|
inlineLimit
|
|
230
244
|
} = opts.config;
|
|
231
|
-
let crossOriginLoading = false;
|
|
232
|
-
if ((_a = webpackConfig.output) == null ? void 0 : _a.crossOriginLoading) {
|
|
233
|
-
crossOriginLoading = webpackConfig.output.crossOriginLoading;
|
|
234
|
-
}
|
|
235
245
|
utooBundlerOpts = {
|
|
236
246
|
...utooBundlerOpts,
|
|
237
247
|
config: import_utils.lodash.merge(
|
|
@@ -240,8 +250,7 @@ async function getProdUtooPackConfig(opts) {
|
|
|
240
250
|
output: {
|
|
241
251
|
clean: opts.clean,
|
|
242
252
|
publicPath: runtimePublicPath ? "runtime" : publicPath || "/",
|
|
243
|
-
...opts.disableCopy ? { copy: [] } : { copy: ["public"].concat(copy) }
|
|
244
|
-
crossOriginLoading
|
|
253
|
+
...opts.disableCopy ? { copy: [] } : { copy: ["public"].concat(copy) }
|
|
245
254
|
},
|
|
246
255
|
optimization: {
|
|
247
256
|
modularizeImports,
|
|
@@ -249,7 +258,7 @@ async function getProdUtooPackConfig(opts) {
|
|
|
249
258
|
},
|
|
250
259
|
resolve: {
|
|
251
260
|
alias: getNormalizedAlias(
|
|
252
|
-
(
|
|
261
|
+
(_a = utooBundlerOpts.config.resolve) == null ? void 0 : _a.alias,
|
|
253
262
|
opts.rootDir
|
|
254
263
|
)
|
|
255
264
|
},
|
|
@@ -276,7 +285,7 @@ async function getProdUtooPackConfig(opts) {
|
|
|
276
285
|
return utooBundlerOpts;
|
|
277
286
|
}
|
|
278
287
|
async function getDevUtooPackConfig(opts) {
|
|
279
|
-
var _a
|
|
288
|
+
var _a;
|
|
280
289
|
let webpackConfig = await (0, import_bundler_webpack.getConfig)({
|
|
281
290
|
cwd: opts.cwd,
|
|
282
291
|
rootDir: opts.rootDir,
|
|
@@ -321,10 +330,6 @@ async function getDevUtooPackConfig(opts) {
|
|
|
321
330
|
svgo = {},
|
|
322
331
|
inlineLimit
|
|
323
332
|
} = opts.config;
|
|
324
|
-
let crossOriginLoading = false;
|
|
325
|
-
if ((_a = webpackConfig.output) == null ? void 0 : _a.crossOriginLoading) {
|
|
326
|
-
crossOriginLoading = webpackConfig.output.crossOriginLoading;
|
|
327
|
-
}
|
|
328
333
|
utooBundlerOpts = {
|
|
329
334
|
...utooBundlerOpts,
|
|
330
335
|
config: import_utils.lodash.merge(
|
|
@@ -334,12 +339,11 @@ async function getDevUtooPackConfig(opts) {
|
|
|
334
339
|
// utoopack 的 dev 需要默认清空产物目录
|
|
335
340
|
clean: opts.clean === void 0 ? true : opts.clean,
|
|
336
341
|
publicPath: runtimePublicPath ? "runtime" : publicPath || "/",
|
|
337
|
-
...opts.disableCopy ? { copy: [] } : { copy: ["public"].concat(copy) }
|
|
338
|
-
crossOriginLoading
|
|
342
|
+
...opts.disableCopy ? { copy: [] } : { copy: ["public"].concat(copy) }
|
|
339
343
|
},
|
|
340
344
|
resolve: {
|
|
341
345
|
alias: getNormalizedAlias(
|
|
342
|
-
(
|
|
346
|
+
(_a = utooBundlerOpts.config.resolve) == null ? void 0 : _a.alias,
|
|
343
347
|
opts.rootDir
|
|
344
348
|
)
|
|
345
349
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-utoopack",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.38",
|
|
4
4
|
"description": "@umijs/bundler-utoopack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@utoo/pack": "1.3.
|
|
11
|
+
"@utoo/pack": "1.3.7",
|
|
12
12
|
"compression": "^1.7.4",
|
|
13
13
|
"connect-history-api-fallback": "^2.0.0",
|
|
14
14
|
"cors": "^2.8.5",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"postcss": "^8.4.21",
|
|
20
20
|
"sass": "1.54.0",
|
|
21
21
|
"sass-loader": "13.2.0",
|
|
22
|
-
"@umijs/bundler-utils": "4.6.
|
|
23
|
-
"@umijs/bundler-webpack": "4.6.
|
|
22
|
+
"@umijs/bundler-utils": "4.6.38",
|
|
23
|
+
"@umijs/bundler-webpack": "4.6.38"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"father": "4.1.5"
|