@umijs/bundler-utoopack 4.6.0 → 4.6.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.
Files changed (2) hide show
  1. package/dist/config.js +16 -8
  2. package/package.json +4 -4
package/dist/config.js CHANGED
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(config_exports);
26
26
  var import_bundler_webpack = require("@umijs/bundler-webpack");
27
27
  var import_utils = require("@umijs/utils");
28
28
  var import_pack = require("@utoo/pack");
29
+ var import_path = require("path");
29
30
  function convertProcessEnvForUtoopack(webpackConfig) {
30
31
  var _a;
31
32
  let processEnvForUtoopack = {};
@@ -88,11 +89,14 @@ function getModularizeImports(extraBabelPlugins) {
88
89
  }
89
90
  function getNormalizedAlias(alias, rootDir) {
90
91
  const newAlias = { ...alias };
91
- const keysToExpand = ["react", "react-dom", "@", "@@"];
92
- for (const key of keysToExpand) {
93
- if (newAlias[key]) {
94
- newAlias[`${key}/*`] = `${newAlias[key]}/*`;
92
+ for (const [key, value] of Object.entries(newAlias)) {
93
+ if (key.endsWith("/*") || value.endsWith("/*") || key.endsWith("/") || value.endsWith("/") || key.endsWith("$")) {
94
+ continue;
95
95
  }
96
+ if ((0, import_path.extname)(value)) {
97
+ continue;
98
+ }
99
+ newAlias[`${key}/*`] = `${value}/*`;
96
100
  }
97
101
  newAlias[`${rootDir}/*`] = `${rootDir}/*`;
98
102
  return newAlias;
@@ -154,7 +158,8 @@ async function getProdUtooPackConfig(opts) {
154
158
  const {
155
159
  publicPath,
156
160
  runtimePublicPath,
157
- externals: userExternals
161
+ externals: userExternals,
162
+ copy = []
158
163
  } = opts.config;
159
164
  utooBundlerOpts = {
160
165
  ...utooBundlerOpts,
@@ -163,7 +168,8 @@ async function getProdUtooPackConfig(opts) {
163
168
  {
164
169
  output: {
165
170
  clean: opts.clean,
166
- publicPath: runtimePublicPath ? "runtime" : publicPath || "/"
171
+ publicPath: runtimePublicPath ? "runtime" : publicPath || "/",
172
+ ...opts.disableCopy ? { copy: [] } : { copy: ["public"].concat(copy) }
167
173
  },
168
174
  optimization: {
169
175
  modularizeImports,
@@ -232,7 +238,8 @@ async function getDevUtooPackConfig(opts) {
232
238
  const {
233
239
  publicPath,
234
240
  runtimePublicPath,
235
- externals: userExternals
241
+ externals: userExternals,
242
+ copy = []
236
243
  } = opts.config;
237
244
  utooBundlerOpts = {
238
245
  ...utooBundlerOpts,
@@ -242,7 +249,8 @@ async function getDevUtooPackConfig(opts) {
242
249
  output: {
243
250
  // utoopack 的 dev 需要默认清空产物目录
244
251
  clean: opts.clean === void 0 ? true : opts.clean,
245
- publicPath: runtimePublicPath ? "runtime" : publicPath || "/"
252
+ publicPath: runtimePublicPath ? "runtime" : publicPath || "/",
253
+ ...opts.disableCopy ? { copy: [] } : { copy: ["public"].concat(copy) }
246
254
  },
247
255
  resolve: {
248
256
  alias: getNormalizedAlias(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-utoopack",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "description": "@umijs/bundler-utoopack",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,14 +8,14 @@
8
8
  "dist"
9
9
  ],
10
10
  "dependencies": {
11
- "@utoo/pack": "1.0.0",
11
+ "@utoo/pack": "1.0.1",
12
12
  "compression": "^1.7.4",
13
13
  "connect-history-api-fallback": "^2.0.0",
14
14
  "cors": "^2.8.5",
15
15
  "express": "^4.18.2",
16
16
  "express-http-proxy": "^2.1.1",
17
- "@umijs/bundler-utils": "4.6.0",
18
- "@umijs/bundler-webpack": "4.6.0"
17
+ "@umijs/bundler-utils": "4.6.2",
18
+ "@umijs/bundler-webpack": "4.6.2"
19
19
  },
20
20
  "devDependencies": {
21
21
  "father": "4.1.5"