@umijs/bundler-webpack 4.2.5 → 4.2.6-alpha.0
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/compiled/webpack-5-chain/package.json +1 -1
- package/compiled/webpack-5-chain/types/index.d.ts +1 -1
- package/dist/config/config.d.ts +0 -2
- package/dist/config/config.js +1 -3
- package/dist/config/definePlugin.d.ts +6 -4
- package/dist/config/definePlugin.js +15 -29
- package/dist/dev.js +2 -6
- package/dist/requireHook.js +1 -2
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"webpack-5-chain","version":"8.0.
|
|
1
|
+
{"name":"webpack-5-chain","version":"8.0.1","author":"Eli Perelman <eli@eliperelman.com>","license":"MPL-2.0","typings":"types/index.d.ts"}
|
|
@@ -200,7 +200,7 @@ declare namespace Config {
|
|
|
200
200
|
): this;
|
|
201
201
|
devtoolNamespace(value: WebpackOutput['devtoolNamespace']): this;
|
|
202
202
|
filename(value: WebpackOutput['filename']): this;
|
|
203
|
-
|
|
203
|
+
assetModuleFilenamet(value: WebpackOutput['assetModuleFilename']): this;
|
|
204
204
|
globalObject(value: WebpackOutput['globalObject']): this;
|
|
205
205
|
uniqueName(value: WebpackOutput['uniqueName']): this;
|
|
206
206
|
hashDigest(value: WebpackOutput['hashDigest']): this;
|
package/dist/config/config.d.ts
CHANGED
package/dist/config/config.js
CHANGED
|
@@ -84,9 +84,7 @@ async function getConfig(opts) {
|
|
|
84
84
|
targets: userConfig.targets
|
|
85
85
|
}),
|
|
86
86
|
useHash,
|
|
87
|
-
staticPathPrefix: opts.staticPathPrefix !== void 0 ? opts.staticPathPrefix : "static/"
|
|
88
|
-
port: opts.port,
|
|
89
|
-
host: opts.host
|
|
87
|
+
staticPathPrefix: opts.staticPathPrefix !== void 0 ? opts.staticPathPrefix : "static/"
|
|
90
88
|
};
|
|
91
89
|
config.name(opts.name);
|
|
92
90
|
config.mode(opts.env);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import
|
|
2
|
+
import { Env, IConfig } from '../types';
|
|
3
3
|
interface IOpts {
|
|
4
4
|
config: Config;
|
|
5
5
|
userConfig: IConfig;
|
|
6
6
|
cwd: string;
|
|
7
7
|
env: Env;
|
|
8
|
-
host?: string;
|
|
9
|
-
port?: number;
|
|
10
8
|
}
|
|
11
|
-
export declare function resolveDefine(opts:
|
|
9
|
+
export declare function resolveDefine(opts: {
|
|
10
|
+
define: any;
|
|
11
|
+
publicPath?: string;
|
|
12
|
+
}): {
|
|
12
13
|
'process.env': Record<string, any>;
|
|
14
|
+
'process.env.SSR_MANIFEST': string;
|
|
13
15
|
};
|
|
14
16
|
export declare function addDefinePlugin(opts: IOpts): Promise<void>;
|
|
15
17
|
export {};
|
|
@@ -26,51 +26,37 @@ module.exports = __toCommonJS(definePlugin_exports);
|
|
|
26
26
|
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
27
27
|
var prefixRE = /^UMI_APP_/;
|
|
28
28
|
var ENV_SHOULD_PASS = ["NODE_ENV", "HMR", "SOCKET_SERVER", "ERROR_OVERLAY"];
|
|
29
|
-
var SOCKET_IGNORE_HOSTS = ["0.0.0.0", "127.0.0.1", "localhost"];
|
|
30
|
-
var CUSTOM_ENV_GETTER = {
|
|
31
|
-
SOCKET_SERVER: (opts) => {
|
|
32
|
-
const { userConfig, host, port } = opts;
|
|
33
|
-
const socketServer = process.env.SOCKET_SERVER;
|
|
34
|
-
if (socketServer) {
|
|
35
|
-
return socketServer;
|
|
36
|
-
}
|
|
37
|
-
if (host && !SOCKET_IGNORE_HOSTS.includes(host)) {
|
|
38
|
-
const protocol = userConfig.https ? "https:" : "http:";
|
|
39
|
-
return `${protocol}//${host}:${port || 8e3}`;
|
|
40
|
-
}
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
29
|
function resolveDefine(opts) {
|
|
45
|
-
const { userConfig } = opts;
|
|
46
30
|
const env = {};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const envValue = CUSTOM_ENV_GETTER[key] ? CUSTOM_ENV_GETTER[key](opts) : process.env[key];
|
|
51
|
-
if (typeof envValue === "undefined") {
|
|
52
|
-
return;
|
|
31
|
+
Object.keys(process.env).forEach((key) => {
|
|
32
|
+
if (prefixRE.test(key) || ENV_SHOULD_PASS.includes(key)) {
|
|
33
|
+
env[key] = process.env[key];
|
|
53
34
|
}
|
|
54
|
-
env[key] = envValue;
|
|
55
35
|
});
|
|
56
|
-
env.PUBLIC_PATH =
|
|
36
|
+
env.PUBLIC_PATH = opts.publicPath || "/";
|
|
57
37
|
for (const key in env) {
|
|
58
38
|
env[key] = JSON.stringify(env[key]);
|
|
59
39
|
}
|
|
60
40
|
const define = {};
|
|
61
|
-
if (
|
|
62
|
-
for (const key in
|
|
63
|
-
define[key] = JSON.stringify(
|
|
41
|
+
if (opts.define) {
|
|
42
|
+
for (const key in opts.define) {
|
|
43
|
+
define[key] = JSON.stringify(opts.define[key]);
|
|
64
44
|
}
|
|
65
45
|
}
|
|
66
46
|
return {
|
|
67
47
|
"process.env": env,
|
|
48
|
+
"process.env.SSR_MANIFEST": "process.env.SSR_MANIFEST",
|
|
68
49
|
...define
|
|
69
50
|
};
|
|
70
51
|
}
|
|
71
52
|
async function addDefinePlugin(opts) {
|
|
72
|
-
const { config } = opts;
|
|
73
|
-
config.plugin("define").use(import_webpack.DefinePlugin, [
|
|
53
|
+
const { config, userConfig } = opts;
|
|
54
|
+
config.plugin("define").use(import_webpack.DefinePlugin, [
|
|
55
|
+
resolveDefine({
|
|
56
|
+
define: userConfig.define || {},
|
|
57
|
+
publicPath: userConfig.publicPath
|
|
58
|
+
})
|
|
59
|
+
]);
|
|
74
60
|
}
|
|
75
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
76
62
|
0 && (module.exports = {
|
package/dist/dev.js
CHANGED
|
@@ -150,9 +150,7 @@ async function setup(opts) {
|
|
|
150
150
|
)
|
|
151
151
|
} : void 0,
|
|
152
152
|
pkg: opts.pkg,
|
|
153
|
-
disableCopy: opts.disableCopy
|
|
154
|
-
port: opts.port,
|
|
155
|
-
host: opts.host
|
|
153
|
+
disableCopy: opts.disableCopy
|
|
156
154
|
});
|
|
157
155
|
const depConfig = await configModule.getConfig({
|
|
158
156
|
cwd: opts.cwd,
|
|
@@ -170,9 +168,7 @@ async function setup(opts) {
|
|
|
170
168
|
buildDependencies: (_j = opts.cache) == null ? void 0 : _j.buildDependencies,
|
|
171
169
|
cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "mfsu-deps")
|
|
172
170
|
},
|
|
173
|
-
pkg: opts.pkg
|
|
174
|
-
port: opts.port,
|
|
175
|
-
host: opts.host
|
|
171
|
+
pkg: opts.pkg
|
|
176
172
|
});
|
|
177
173
|
(_k = webpackConfig.resolve).alias || (_k.alias = {});
|
|
178
174
|
["@umijs/utils/compiled/strip-ansi", "react-error-overlay"].forEach((dep) => {
|
package/dist/requireHook.js
CHANGED
|
@@ -31,8 +31,7 @@ var hookPropertyMap = /* @__PURE__ */ new Map([
|
|
|
31
31
|
["webpack/package", resolve("compiled/webpack/package")],
|
|
32
32
|
["webpack/package.json", resolve("compiled/webpack/package")],
|
|
33
33
|
["webpack/lib/webpack", resolve("compiled/webpack")],
|
|
34
|
-
["webpack/lib/webpack.js", resolve("compiled/webpack")]
|
|
35
|
-
["tapable", require.resolve("@umijs/bundler-utils/compiled/tapable")]
|
|
34
|
+
["webpack/lib/webpack.js", resolve("compiled/webpack")]
|
|
36
35
|
]);
|
|
37
36
|
import_deepImports.default.forEach((item) => {
|
|
38
37
|
const name = item.split("/").pop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.6-alpha.0",
|
|
4
4
|
"description": "@umijs/bundler-webpack",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"postcss-preset-env": "7.5.0",
|
|
39
39
|
"react-error-overlay": "6.0.9",
|
|
40
40
|
"react-refresh": "0.14.0",
|
|
41
|
-
"@umijs/babel-preset-umi": "4.2.
|
|
42
|
-
"@umijs/bundler-utils": "4.2.
|
|
43
|
-
"@umijs/
|
|
44
|
-
"@umijs/
|
|
41
|
+
"@umijs/babel-preset-umi": "4.2.6-alpha.0",
|
|
42
|
+
"@umijs/bundler-utils": "4.2.6-alpha.0",
|
|
43
|
+
"@umijs/utils": "4.2.6-alpha.0",
|
|
44
|
+
"@umijs/mfsu": "4.2.6-alpha.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@swc/core": "1.3.67",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"terser-webpack-plugin": "5.3.6",
|
|
74
74
|
"url-loader": "4.1.1",
|
|
75
75
|
"webpack": "5.88.2",
|
|
76
|
-
"webpack-5-chain": "8.0.
|
|
76
|
+
"webpack-5-chain": "8.0.1",
|
|
77
77
|
"webpack-bundle-analyzer": "4.7.0",
|
|
78
78
|
"webpack-dev-middleware": "6.0.1",
|
|
79
79
|
"webpack-manifest-plugin": "5.0.0",
|