@umijs/bundler-utoopack 4.0.0-canary.20250918.1 → 4.0.0-canary.20251102.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.
- package/dist/config.js +70 -62
- package/package.json +6 -5
package/dist/config.js
CHANGED
|
@@ -79,6 +79,12 @@ function getNormalizedAlias(alias, rootDir) {
|
|
|
79
79
|
if (newAlias.react) {
|
|
80
80
|
newAlias["react/*"] = `${newAlias.react}/*`;
|
|
81
81
|
}
|
|
82
|
+
if (newAlias["@"]) {
|
|
83
|
+
newAlias["@/*"] = `${newAlias["@"]}/*`;
|
|
84
|
+
}
|
|
85
|
+
if (newAlias["@@"]) {
|
|
86
|
+
newAlias["@@/*"] = `${newAlias["@@"]}/*`;
|
|
87
|
+
}
|
|
82
88
|
newAlias[`${rootDir}/*`] = `${rootDir}/*`;
|
|
83
89
|
return newAlias;
|
|
84
90
|
}
|
|
@@ -116,42 +122,42 @@ async function getProdUtooPackConfig(opts) {
|
|
|
116
122
|
];
|
|
117
123
|
const modularizeImports = getModularizeImports(extraBabelPlugins);
|
|
118
124
|
const processEnvForUtoopack = convertProcessEnvForUtoopack(webpackConfig);
|
|
125
|
+
const { publicPath, runtimePublicPath } = opts.config;
|
|
119
126
|
utooBundlerOpts = {
|
|
120
127
|
...utooBundlerOpts,
|
|
121
|
-
config:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
optimization: {
|
|
128
|
-
...utooBundlerOpts.config.optimization,
|
|
129
|
-
modularizeImports,
|
|
130
|
-
concatenateModules: true
|
|
131
|
-
// minify: false,
|
|
132
|
-
// moduleIds: 'named',
|
|
133
|
-
},
|
|
134
|
-
resolve: {
|
|
135
|
-
...utooBundlerOpts.config.resolve,
|
|
136
|
-
alias: getNormalizedAlias(
|
|
137
|
-
(_a = utooBundlerOpts.config.resolve) == null ? void 0 : _a.alias,
|
|
138
|
-
opts.rootDir
|
|
139
|
-
)
|
|
140
|
-
},
|
|
141
|
-
styles: {
|
|
142
|
-
less: {
|
|
143
|
-
modifyVars: opts.config.theme,
|
|
144
|
-
javascriptEnabled: true,
|
|
145
|
-
...opts.config.lessLoader
|
|
128
|
+
config: import_utils.lodash.merge(
|
|
129
|
+
utooBundlerOpts.config,
|
|
130
|
+
{
|
|
131
|
+
output: {
|
|
132
|
+
clean: opts.clean,
|
|
133
|
+
publicPath: runtimePublicPath ? "runtime" : publicPath || "/"
|
|
146
134
|
},
|
|
147
|
-
|
|
135
|
+
optimization: {
|
|
136
|
+
modularizeImports,
|
|
137
|
+
concatenateModules: true
|
|
138
|
+
},
|
|
139
|
+
resolve: {
|
|
140
|
+
alias: getNormalizedAlias(
|
|
141
|
+
(_a = utooBundlerOpts.config.resolve) == null ? void 0 : _a.alias,
|
|
142
|
+
opts.rootDir
|
|
143
|
+
)
|
|
144
|
+
},
|
|
145
|
+
styles: {
|
|
146
|
+
less: {
|
|
147
|
+
modifyVars: opts.config.theme,
|
|
148
|
+
javascriptEnabled: true,
|
|
149
|
+
...opts.config.lessLoader
|
|
150
|
+
},
|
|
151
|
+
sass: opts.config.sassLoader ?? void 0
|
|
152
|
+
},
|
|
153
|
+
// Override process.env for utoopack format
|
|
154
|
+
define: {
|
|
155
|
+
"process.env": JSON.stringify(processEnvForUtoopack)
|
|
156
|
+
},
|
|
157
|
+
nodePolyfill: true
|
|
148
158
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
...utooBundlerOpts.config.define,
|
|
152
|
-
"process.env": JSON.stringify(processEnvForUtoopack)
|
|
153
|
-
}
|
|
154
|
-
}
|
|
159
|
+
opts.config.utoopack || {}
|
|
160
|
+
)
|
|
155
161
|
};
|
|
156
162
|
return utooBundlerOpts;
|
|
157
163
|
}
|
|
@@ -189,40 +195,42 @@ async function getDevUtooPackConfig(opts) {
|
|
|
189
195
|
];
|
|
190
196
|
const modularizeImports = getModularizeImports(extraBabelPlugins);
|
|
191
197
|
const processEnvForUtoopack = convertProcessEnvForUtoopack(webpackConfig);
|
|
198
|
+
const { publicPath, runtimePublicPath } = opts.config;
|
|
192
199
|
utooBundlerOpts = {
|
|
193
200
|
...utooBundlerOpts,
|
|
194
|
-
config:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
},
|
|
208
|
-
optimization: {
|
|
209
|
-
...utooBundlerOpts.config.optimization,
|
|
210
|
-
modularizeImports
|
|
211
|
-
},
|
|
212
|
-
styles: {
|
|
213
|
-
less: {
|
|
214
|
-
modifyVars: opts.config.theme,
|
|
215
|
-
javascriptEnabled: true,
|
|
216
|
-
...opts.config.lessLoader
|
|
201
|
+
config: import_utils.lodash.merge(
|
|
202
|
+
utooBundlerOpts.config,
|
|
203
|
+
{
|
|
204
|
+
output: {
|
|
205
|
+
// utoopack 的 dev 需要默认清空产物目录
|
|
206
|
+
clean: opts.clean === void 0 ? true : opts.clean,
|
|
207
|
+
publicPath: runtimePublicPath ? "runtime" : publicPath || "/"
|
|
208
|
+
},
|
|
209
|
+
resolve: {
|
|
210
|
+
alias: getNormalizedAlias(
|
|
211
|
+
(_a = utooBundlerOpts.config.resolve) == null ? void 0 : _a.alias,
|
|
212
|
+
opts.rootDir
|
|
213
|
+
)
|
|
217
214
|
},
|
|
218
|
-
|
|
215
|
+
optimization: {
|
|
216
|
+
modularizeImports
|
|
217
|
+
},
|
|
218
|
+
styles: {
|
|
219
|
+
less: {
|
|
220
|
+
modifyVars: opts.config.theme,
|
|
221
|
+
javascriptEnabled: true,
|
|
222
|
+
...opts.config.lessLoader
|
|
223
|
+
},
|
|
224
|
+
sass: opts.config.sassLoader ?? void 0
|
|
225
|
+
},
|
|
226
|
+
// Override process.env for utoopack format
|
|
227
|
+
define: {
|
|
228
|
+
"process.env": JSON.stringify(processEnvForUtoopack)
|
|
229
|
+
},
|
|
230
|
+
nodePolyfill: true
|
|
219
231
|
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
...utooBundlerOpts.config.define,
|
|
223
|
-
"process.env": JSON.stringify(processEnvForUtoopack)
|
|
224
|
-
}
|
|
225
|
-
},
|
|
232
|
+
opts.config.utoopack || {}
|
|
233
|
+
),
|
|
226
234
|
watch: {
|
|
227
235
|
enable: true
|
|
228
236
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-utoopack",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20251102.1",
|
|
4
4
|
"description": "@umijs/bundler-utoopack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,21 +13,22 @@
|
|
|
13
13
|
"cors": "^2.8.5",
|
|
14
14
|
"express": "^4.18.2",
|
|
15
15
|
"express-http-proxy": "^2.1.1",
|
|
16
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
17
|
-
"@umijs/bundler-webpack": "4.0.0-canary.
|
|
16
|
+
"@umijs/bundler-utils": "4.0.0-canary.20251102.1",
|
|
17
|
+
"@umijs/bundler-webpack": "4.0.0-canary.20251102.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@utoo/pack": "0.0.1-alpha.
|
|
20
|
+
"@utoo/pack": "^0.0.1-alpha.60",
|
|
21
21
|
"father": "4.1.5"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@utoo/pack": "^0.0.1-alpha.
|
|
24
|
+
"@utoo/pack": "^0.0.1-alpha.60"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "father build",
|
|
31
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
31
32
|
"dev": "father dev"
|
|
32
33
|
}
|
|
33
34
|
}
|