@umijs/bundler-webpack 4.0.0-rc.20 → 4.0.0-rc.23
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/index.js +3076 -3828
- package/compiled/webpack-dev-middleware/index.js +8 -7
- package/dist/build.js +3 -1
- package/dist/config/config.js +6 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/plugins/RuntimePublicPathPlugin.js +3 -0
- package/dist/server/server.d.ts +1 -0
- package/dist/server/server.js +5 -3
- package/dist/server/ws.d.ts +2 -0
- package/package.json +9 -9
package/dist/build.js
CHANGED
|
@@ -32,7 +32,9 @@ async function build(opts) {
|
|
|
32
32
|
});
|
|
33
33
|
let isFirstCompile = true;
|
|
34
34
|
return new Promise((resolve, reject) => {
|
|
35
|
-
|
|
35
|
+
if (opts.clean) {
|
|
36
|
+
utils_1.rimraf.sync(webpackConfig.output.path);
|
|
37
|
+
}
|
|
36
38
|
const compiler = (0, webpack_1.default)(webpackConfig);
|
|
37
39
|
compiler.run((err, stats) => {
|
|
38
40
|
var _a;
|
package/dist/config/config.js
CHANGED
|
@@ -75,7 +75,7 @@ async function getConfig(opts) {
|
|
|
75
75
|
config.output
|
|
76
76
|
.path(absOutputPath)
|
|
77
77
|
.filename(useHash ? `[name].[contenthash:8].js` : `[name].js`)
|
|
78
|
-
.chunkFilename(useHash ? `[name].[contenthash:8].async.js` : `[name].js`)
|
|
78
|
+
.chunkFilename(useHash ? `[name].[contenthash:8].async.js` : `[name].async.js`)
|
|
79
79
|
.publicPath(userConfig.publicPath || 'auto')
|
|
80
80
|
.pathinfo(isDev || disableCompress);
|
|
81
81
|
// resolve
|
|
@@ -166,13 +166,14 @@ async function getConfig(opts) {
|
|
|
166
166
|
// tnpm 安装依赖的情况 webpack 默认的 managedPaths 不生效
|
|
167
167
|
// 使用 immutablePaths 避免 node_modules 的内容被写入缓存
|
|
168
168
|
// tnpm 安装的依赖路径中同时包含包名和版本号,满足 immutablePaths 使用的条件
|
|
169
|
+
// 同时配置 managedPaths 将 tnpm 的软连接结构标记为可信,避免执行快照序列化时 OOM
|
|
169
170
|
// ref: smallfish
|
|
170
171
|
if ( /*isTnpm*/require('@umijs/utils/package').__npminstall_done) {
|
|
172
|
+
const nodeModulesPath = opts.cache.absNodeModulesPath ||
|
|
173
|
+
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules');
|
|
171
174
|
config.snapshot({
|
|
172
|
-
immutablePaths: [
|
|
173
|
-
|
|
174
|
-
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules'),
|
|
175
|
-
],
|
|
175
|
+
immutablePaths: [nodeModulesPath],
|
|
176
|
+
managedPaths: [nodeModulesPath],
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
179
|
config.infrastructureLogging({
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
require("./requireHook");
|
|
17
18
|
__exportStar(require("./build"), exports);
|
|
18
19
|
__exportStar(require("./config/config"), exports);
|
|
19
20
|
__exportStar(require("./dev"), exports);
|
|
@@ -10,6 +10,9 @@ class RuntimePublicPathPlugin {
|
|
|
10
10
|
// The hook to get the public path ('__webpack_require__.p')
|
|
11
11
|
// https://github.com/webpack/webpack/blob/master/lib/runtime/PublicPathRuntimeModule.js
|
|
12
12
|
if (module.constructor.name === 'PublicPathRuntimeModule') {
|
|
13
|
+
// If current public path is handled by mini-css-extract-plugin, skip it
|
|
14
|
+
if (module.getGeneratedCode().includes('webpack:///mini-css-extract-plugin'))
|
|
15
|
+
return;
|
|
13
16
|
// @ts-ignore
|
|
14
17
|
module._cachedGeneratedCode = `__webpack_require__.p = (globalThis || window).publicPath || '/';`;
|
|
15
18
|
}
|
package/dist/server/server.d.ts
CHANGED
package/dist/server/server.js
CHANGED
|
@@ -32,9 +32,11 @@ async function createServer(opts) {
|
|
|
32
32
|
(opts.beforeMiddlewares || []).forEach((m) => app.use(m));
|
|
33
33
|
// TODO: add to before middleware
|
|
34
34
|
app.use((req, res, next) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const file = req.path;
|
|
36
|
+
const filePath = (0, path_1.join)(opts.cwd, file);
|
|
37
|
+
const ext = (0, path_1.extname)(filePath);
|
|
38
|
+
if (ext === '.js' && (0, fs_1.existsSync)(filePath)) {
|
|
39
|
+
res.sendFile(filePath);
|
|
38
40
|
}
|
|
39
41
|
else {
|
|
40
42
|
next();
|
package/dist/server/ws.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.23",
|
|
4
4
|
"description": "@umijs/bundler-webpack",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-webpack#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"test": "umi-scripts jest-turbo"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@parcel/css": "1.
|
|
33
|
-
"@pmmmwh/react-refresh-webpack-plugin": "0.5.
|
|
32
|
+
"@parcel/css": "1.9.0",
|
|
33
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.7",
|
|
34
34
|
"@svgr/core": "6.2.1",
|
|
35
35
|
"@svgr/plugin-jsx": "^6.2.1",
|
|
36
36
|
"@svgr/plugin-svgo": "^6.2.0",
|
|
37
37
|
"@types/hapi__joi": "17.1.8",
|
|
38
|
-
"@umijs/babel-preset-umi": "4.0.0-rc.
|
|
39
|
-
"@umijs/bundler-utils": "4.0.0-rc.
|
|
40
|
-
"@umijs/mfsu": "4.0.0-rc.
|
|
41
|
-
"@umijs/utils": "4.0.0-rc.
|
|
38
|
+
"@umijs/babel-preset-umi": "4.0.0-rc.23",
|
|
39
|
+
"@umijs/bundler-utils": "4.0.0-rc.23",
|
|
40
|
+
"@umijs/mfsu": "4.0.0-rc.23",
|
|
41
|
+
"@umijs/utils": "4.0.0-rc.23",
|
|
42
42
|
"cors": "^2.8.5",
|
|
43
43
|
"css-loader": "6.7.1",
|
|
44
44
|
"es5-imcompatible-versions": "^0.1.73",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"terser": "5.12.1",
|
|
77
77
|
"terser-webpack-plugin": "5.3.1",
|
|
78
78
|
"url-loader": "4.1.1",
|
|
79
|
-
"webpack": "5.72.
|
|
79
|
+
"webpack": "5.72.1",
|
|
80
80
|
"webpack-5-chain": "8.0.0",
|
|
81
81
|
"webpack-bundle-analyzer": "4.5.0",
|
|
82
|
-
"webpack-dev-middleware": "5.3.
|
|
82
|
+
"webpack-dev-middleware": "5.3.3",
|
|
83
83
|
"webpack-manifest-plugin": "5.0.0",
|
|
84
84
|
"webpack-sources": "3.2.3",
|
|
85
85
|
"ws": "8.5.0"
|