@umijs/bundler-utoopack 4.6.5 → 4.6.7
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 +2 -33
- package/package.json +4 -4
package/dist/config.js
CHANGED
|
@@ -27,27 +27,6 @@ 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
29
|
var import_path = require("path");
|
|
30
|
-
function convertProcessEnvForUtoopack(webpackConfig) {
|
|
31
|
-
var _a;
|
|
32
|
-
let processEnvForUtoopack = {};
|
|
33
|
-
if (webpackConfig.plugins) {
|
|
34
|
-
const definePlugin = webpackConfig.plugins.find(
|
|
35
|
-
(plugin) => plugin.constructor.name === "DefinePlugin"
|
|
36
|
-
);
|
|
37
|
-
if ((_a = definePlugin == null ? void 0 : definePlugin.definitions) == null ? void 0 : _a["process.env"]) {
|
|
38
|
-
for (const [key, value] of Object.entries(
|
|
39
|
-
definePlugin.definitions["process.env"]
|
|
40
|
-
)) {
|
|
41
|
-
if (typeof value === "string" && value.startsWith('"') && value.endsWith('"')) {
|
|
42
|
-
processEnvForUtoopack[key] = JSON.parse(value);
|
|
43
|
-
} else {
|
|
44
|
-
processEnvForUtoopack[key] = value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return processEnvForUtoopack;
|
|
50
|
-
}
|
|
51
30
|
function getModularizeImports(extraBabelPlugins) {
|
|
52
31
|
return extraBabelPlugins.filter((p) => /^import$|babel-plugin-import/.test(p[0])).reduce(
|
|
53
32
|
(acc, [_, v]) => {
|
|
@@ -147,14 +126,13 @@ async function getProdUtooPackConfig(opts) {
|
|
|
147
126
|
});
|
|
148
127
|
let utooBundlerOpts = (0, import_pack.compatOptionsFromWebpack)({
|
|
149
128
|
...import_utils.lodash.omit(webpackConfig, ["target", "module", "externals"]),
|
|
150
|
-
|
|
129
|
+
webpackMode: true
|
|
151
130
|
});
|
|
152
131
|
const extraBabelPlugins = [
|
|
153
132
|
...opts.extraBabelPlugins || [],
|
|
154
133
|
...opts.config.extraBabelPlugins || []
|
|
155
134
|
];
|
|
156
135
|
const modularizeImports = getModularizeImports(extraBabelPlugins);
|
|
157
|
-
const processEnvForUtoopack = convertProcessEnvForUtoopack(webpackConfig);
|
|
158
136
|
const {
|
|
159
137
|
publicPath,
|
|
160
138
|
runtimePublicPath,
|
|
@@ -189,10 +167,6 @@ async function getProdUtooPackConfig(opts) {
|
|
|
189
167
|
},
|
|
190
168
|
sass: opts.config.sassLoader ?? void 0
|
|
191
169
|
},
|
|
192
|
-
// Override process.env for utoopack format
|
|
193
|
-
define: {
|
|
194
|
-
"process.env": JSON.stringify(processEnvForUtoopack)
|
|
195
|
-
},
|
|
196
170
|
nodePolyfill: true,
|
|
197
171
|
externals: getNormalizedExternals(userExternals)
|
|
198
172
|
},
|
|
@@ -227,14 +201,13 @@ async function getDevUtooPackConfig(opts) {
|
|
|
227
201
|
});
|
|
228
202
|
let utooBundlerOpts = (0, import_pack.compatOptionsFromWebpack)({
|
|
229
203
|
...import_utils.lodash.omit(webpackConfig, ["target", "module", "externals"]),
|
|
230
|
-
|
|
204
|
+
webpackMode: true
|
|
231
205
|
});
|
|
232
206
|
const extraBabelPlugins = [
|
|
233
207
|
...opts.extraBabelPlugins || [],
|
|
234
208
|
...opts.config.extraBabelPlugins || []
|
|
235
209
|
];
|
|
236
210
|
const modularizeImports = getModularizeImports(extraBabelPlugins);
|
|
237
|
-
const processEnvForUtoopack = convertProcessEnvForUtoopack(webpackConfig);
|
|
238
211
|
const {
|
|
239
212
|
publicPath,
|
|
240
213
|
runtimePublicPath,
|
|
@@ -269,10 +242,6 @@ async function getDevUtooPackConfig(opts) {
|
|
|
269
242
|
},
|
|
270
243
|
sass: opts.config.sassLoader ?? void 0
|
|
271
244
|
},
|
|
272
|
-
// Override process.env for utoopack format
|
|
273
|
-
define: {
|
|
274
|
-
"process.env": JSON.stringify(processEnvForUtoopack)
|
|
275
|
-
},
|
|
276
245
|
nodePolyfill: true,
|
|
277
246
|
externals: getNormalizedExternals(userExternals)
|
|
278
247
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-utoopack",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.7",
|
|
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.
|
|
11
|
+
"@utoo/pack": "1.0.7",
|
|
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-
|
|
18
|
-
"@umijs/bundler-
|
|
17
|
+
"@umijs/bundler-webpack": "4.6.7",
|
|
18
|
+
"@umijs/bundler-utils": "4.6.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"father": "4.1.5"
|