@umijs/bundler-webpack 4.2.6-alpha.1 → 4.2.6-alpha.10
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 +2 -0
- package/dist/config/config.js +3 -1
- package/dist/config/definePlugin.d.ts +4 -5
- package/dist/config/definePlugin.js +29 -14
- package/dist/dev.js +6 -2
- package/dist/requireHook.js +2 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"webpack-5-chain","version":"8.0.
|
|
1
|
+
{"name":"webpack-5-chain","version":"8.0.2","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
|
+
assetModuleFilename(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,7 +84,9 @@ async function getConfig(opts) {
|
|
|
84
84
|
targets: userConfig.targets
|
|
85
85
|
}),
|
|
86
86
|
useHash,
|
|
87
|
-
staticPathPrefix: opts.staticPathPrefix !== void 0 ? opts.staticPathPrefix : "static/"
|
|
87
|
+
staticPathPrefix: opts.staticPathPrefix !== void 0 ? opts.staticPathPrefix : "static/",
|
|
88
|
+
port: opts.port,
|
|
89
|
+
host: opts.host
|
|
88
90
|
};
|
|
89
91
|
config.name(opts.name);
|
|
90
92
|
config.mode(opts.env);
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
2
|
+
import type { 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;
|
|
8
10
|
}
|
|
9
|
-
export declare function resolveDefine(opts: {
|
|
10
|
-
define: any;
|
|
11
|
-
publicPath?: string;
|
|
12
|
-
}): {
|
|
11
|
+
export declare function resolveDefine(opts: IOpts): {
|
|
13
12
|
'process.env': Record<string, any>;
|
|
14
13
|
'process.env.SSR_MANIFEST': string;
|
|
15
14
|
};
|
|
@@ -26,21 +26,41 @@ 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
|
+
};
|
|
29
44
|
function resolveDefine(opts) {
|
|
45
|
+
const { userConfig } = opts;
|
|
30
46
|
const env = {};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
47
|
+
ENV_SHOULD_PASS.concat(
|
|
48
|
+
Object.keys(process.env).filter((k) => prefixRE.test(k))
|
|
49
|
+
).forEach((key) => {
|
|
50
|
+
const envValue = CUSTOM_ENV_GETTER[key] ? CUSTOM_ENV_GETTER[key](opts) : process.env[key];
|
|
51
|
+
if (typeof envValue === "undefined") {
|
|
52
|
+
return;
|
|
34
53
|
}
|
|
54
|
+
env[key] = envValue;
|
|
35
55
|
});
|
|
36
|
-
env.PUBLIC_PATH =
|
|
56
|
+
env.PUBLIC_PATH = userConfig.publicPath || "/";
|
|
37
57
|
for (const key in env) {
|
|
38
58
|
env[key] = JSON.stringify(env[key]);
|
|
39
59
|
}
|
|
40
60
|
const define = {};
|
|
41
|
-
if (
|
|
42
|
-
for (const key in
|
|
43
|
-
define[key] = JSON.stringify(
|
|
61
|
+
if (userConfig.define) {
|
|
62
|
+
for (const key in userConfig.define) {
|
|
63
|
+
define[key] = JSON.stringify(userConfig.define[key]);
|
|
44
64
|
}
|
|
45
65
|
}
|
|
46
66
|
return {
|
|
@@ -50,13 +70,8 @@ function resolveDefine(opts) {
|
|
|
50
70
|
};
|
|
51
71
|
}
|
|
52
72
|
async function addDefinePlugin(opts) {
|
|
53
|
-
const { config
|
|
54
|
-
config.plugin("define").use(import_webpack.DefinePlugin, [
|
|
55
|
-
resolveDefine({
|
|
56
|
-
define: userConfig.define || {},
|
|
57
|
-
publicPath: userConfig.publicPath
|
|
58
|
-
})
|
|
59
|
-
]);
|
|
73
|
+
const { config } = opts;
|
|
74
|
+
config.plugin("define").use(import_webpack.DefinePlugin, [resolveDefine(opts)]);
|
|
60
75
|
}
|
|
61
76
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
77
|
0 && (module.exports = {
|
package/dist/dev.js
CHANGED
|
@@ -150,7 +150,9 @@ async function setup(opts) {
|
|
|
150
150
|
)
|
|
151
151
|
} : void 0,
|
|
152
152
|
pkg: opts.pkg,
|
|
153
|
-
disableCopy: opts.disableCopy
|
|
153
|
+
disableCopy: opts.disableCopy,
|
|
154
|
+
port: opts.port,
|
|
155
|
+
host: opts.host
|
|
154
156
|
});
|
|
155
157
|
const depConfig = await configModule.getConfig({
|
|
156
158
|
cwd: opts.cwd,
|
|
@@ -168,7 +170,9 @@ async function setup(opts) {
|
|
|
168
170
|
buildDependencies: (_j = opts.cache) == null ? void 0 : _j.buildDependencies,
|
|
169
171
|
cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "mfsu-deps")
|
|
170
172
|
},
|
|
171
|
-
pkg: opts.pkg
|
|
173
|
+
pkg: opts.pkg,
|
|
174
|
+
port: opts.port,
|
|
175
|
+
host: opts.host
|
|
172
176
|
});
|
|
173
177
|
(_k = webpackConfig.resolve).alias || (_k.alias = {});
|
|
174
178
|
["@umijs/utils/compiled/strip-ansi", "react-error-overlay"].forEach((dep) => {
|
package/dist/requireHook.js
CHANGED
|
@@ -31,7 +31,8 @@ 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")]
|
|
34
|
+
["webpack/lib/webpack.js", resolve("compiled/webpack")],
|
|
35
|
+
["tapable", require.resolve("@umijs/bundler-utils/compiled/tapable")]
|
|
35
36
|
]);
|
|
36
37
|
import_deepImports.default.forEach((item) => {
|
|
37
38
|
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.6-alpha.
|
|
3
|
+
"version": "4.2.6-alpha.10",
|
|
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/
|
|
42
|
-
"@umijs/babel-preset-umi": "4.2.6-alpha.
|
|
43
|
-
"@umijs/utils": "4.2.6-alpha.
|
|
44
|
-
"@umijs/
|
|
41
|
+
"@umijs/mfsu": "4.2.6-alpha.10",
|
|
42
|
+
"@umijs/babel-preset-umi": "4.2.6-alpha.10",
|
|
43
|
+
"@umijs/utils": "4.2.6-alpha.10",
|
|
44
|
+
"@umijs/bundler-utils": "4.2.6-alpha.10"
|
|
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.2",
|
|
77
77
|
"webpack-bundle-analyzer": "4.7.0",
|
|
78
78
|
"webpack-dev-middleware": "6.0.1",
|
|
79
79
|
"webpack-manifest-plugin": "5.0.0",
|