@umijs/bundler-webpack 4.0.10 → 4.0.13
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/dev.js +7 -2
- package/dist/plugins/RuntimePublicPathPlugin.js +1 -1
- package/dist/server/server.js +11 -2
- package/dist/types.d.ts +2 -2
- package/package.json +5 -5
package/dist/dev.js
CHANGED
|
@@ -65,6 +65,10 @@ async function dev(opts) {
|
|
|
65
65
|
const cacheDirectoryPath = (0, import_path.resolve)(opts.rootDir || opts.cwd, opts.config.cacheDirectoryPath || "node_modules/.cache");
|
|
66
66
|
const enableMFSU = opts.config.mfsu !== false;
|
|
67
67
|
let mfsu = null;
|
|
68
|
+
let devHost = "localhost";
|
|
69
|
+
if (opts.host && opts.host !== "0.0.0.0") {
|
|
70
|
+
devHost = opts.host;
|
|
71
|
+
}
|
|
68
72
|
if (enableMFSU) {
|
|
69
73
|
if (opts.config.srcTranspiler === import_types.Transpiler.swc) {
|
|
70
74
|
import_utils.logger.warn(`Swc currently not supported for use with mfsu, recommended you use srcTranspiler: 'esbuild' in dev.`);
|
|
@@ -97,7 +101,7 @@ async function dev(opts) {
|
|
|
97
101
|
publicPath: opts.config.publicPath
|
|
98
102
|
});
|
|
99
103
|
},
|
|
100
|
-
serverBase: `${opts.config.https ? "https" : "http"}://${
|
|
104
|
+
serverBase: `${opts.config.https ? "https" : "http"}://${devHost}:${opts.port || 8e3}`
|
|
101
105
|
});
|
|
102
106
|
}
|
|
103
107
|
const webpackConfig = await (0, import_config.getConfig)({
|
|
@@ -137,6 +141,7 @@ async function dev(opts) {
|
|
|
137
141
|
staticPathPrefix: import_mfsu.MF_DEP_PREFIX,
|
|
138
142
|
name: import_constants.MFSU_NAME,
|
|
139
143
|
chainWebpack: (_i = opts.config.mfsu) == null ? void 0 : _i.chainWebpack,
|
|
144
|
+
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
140
145
|
cache: {
|
|
141
146
|
buildDependencies: (_j = opts.cache) == null ? void 0 : _j.buildDependencies,
|
|
142
147
|
cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "mfsu-deps")
|
|
@@ -169,7 +174,7 @@ async function dev(opts) {
|
|
|
169
174
|
...opts.beforeMiddlewares || []
|
|
170
175
|
],
|
|
171
176
|
port: opts.port,
|
|
172
|
-
host:
|
|
177
|
+
host: devHost,
|
|
173
178
|
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
174
179
|
onDevCompileDone: opts.onDevCompileDone,
|
|
175
180
|
onProgress: opts.onProgress
|
|
@@ -30,7 +30,7 @@ var RuntimePublicPathPlugin = class {
|
|
|
30
30
|
if (module2.constructor.name === "PublicPathRuntimeModule") {
|
|
31
31
|
if (module2.getGeneratedCode().includes("webpack:///mini-css-extract-plugin"))
|
|
32
32
|
return;
|
|
33
|
-
module2._cachedGeneratedCode = `__webpack_require__.p = (typeof globalThis !== undefined ? globalThis : window).publicPath || '/';`;
|
|
33
|
+
module2._cachedGeneratedCode = `__webpack_require__.p = (typeof globalThis !== 'undefined' ? globalThis : window).publicPath || '/';`;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
});
|
package/dist/server/server.js
CHANGED
|
@@ -162,6 +162,13 @@ async function createServer(opts) {
|
|
|
162
162
|
(0, import_assert.default)(typeof proxy2.target === "string", "proxy.target must be string");
|
|
163
163
|
(0, import_assert.default)(proxy2.context, "proxy.context must be supplied");
|
|
164
164
|
middleware = (0, import_http_proxy_middleware.createProxyMiddleware)(proxy2.context, __spreadProps(__spreadValues({}, proxy2), {
|
|
165
|
+
onProxyReq(proxyReq, req, res) {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
if (proxyReq.getHeader("origin")) {
|
|
168
|
+
proxyReq.setHeader("origin", ((_a = new URL(proxy2.target)) == null ? void 0 : _a.href) || "");
|
|
169
|
+
}
|
|
170
|
+
(_b = proxy2.onProxyReq) == null ? void 0 : _b.call(proxy2, proxyReq, req, res);
|
|
171
|
+
},
|
|
165
172
|
onProxyRes(proxyRes, req, res) {
|
|
166
173
|
var _a, _b;
|
|
167
174
|
proxyRes.headers["x-real-url"] = ((_a = new URL(req.url || "", proxy2.target)) == null ? void 0 : _a.href) || "";
|
|
@@ -215,8 +222,10 @@ async function createServer(opts) {
|
|
|
215
222
|
const protocol = userConfig.https ? "https:" : "http:";
|
|
216
223
|
const port = opts.port || 8e3;
|
|
217
224
|
server.listen(port, () => {
|
|
218
|
-
const
|
|
219
|
-
|
|
225
|
+
const banner = (0, import_utils.getDevBanner)(protocol, opts.host, port);
|
|
226
|
+
console.log(banner.before);
|
|
227
|
+
import_utils.logger.ready(banner.main);
|
|
228
|
+
console.log(banner.after);
|
|
220
229
|
});
|
|
221
230
|
return server;
|
|
222
231
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -54,14 +54,14 @@ export interface IConfig {
|
|
|
54
54
|
cssLoaderModules?: {
|
|
55
55
|
[key: string]: any;
|
|
56
56
|
};
|
|
57
|
-
cssMinifier?: CSSMinifier
|
|
57
|
+
cssMinifier?: `${CSSMinifier}`;
|
|
58
58
|
cssMinifierOptions?: {
|
|
59
59
|
[key: string]: any;
|
|
60
60
|
};
|
|
61
61
|
define?: {
|
|
62
62
|
[key: string]: any;
|
|
63
63
|
};
|
|
64
|
-
depTranspiler?: Transpiler
|
|
64
|
+
depTranspiler?: `${Transpiler}`;
|
|
65
65
|
devtool?: Config.DevTool;
|
|
66
66
|
deadCode?: DeadCodeParams;
|
|
67
67
|
https?: HttpsServerOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.13",
|
|
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",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"@svgr/plugin-jsx": "^6.2.1",
|
|
35
35
|
"@svgr/plugin-svgo": "^6.2.0",
|
|
36
36
|
"@types/hapi__joi": "17.1.8",
|
|
37
|
-
"@umijs/babel-preset-umi": "4.0.
|
|
38
|
-
"@umijs/bundler-utils": "4.0.
|
|
37
|
+
"@umijs/babel-preset-umi": "4.0.13",
|
|
38
|
+
"@umijs/bundler-utils": "4.0.13",
|
|
39
39
|
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
|
|
40
|
-
"@umijs/mfsu": "4.0.
|
|
41
|
-
"@umijs/utils": "4.0.
|
|
40
|
+
"@umijs/mfsu": "4.0.13",
|
|
41
|
+
"@umijs/utils": "4.0.13",
|
|
42
42
|
"cors": "^2.8.5",
|
|
43
43
|
"css-loader": "6.7.1",
|
|
44
44
|
"es5-imcompatible-versions": "^0.1.73",
|