@nuxt/webpack-builder 3.2.0 → 3.2.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/index.mjs +29 -1
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import pify from 'pify';
|
|
2
|
-
import webpack from 'webpack';
|
|
2
|
+
import webpack, { RuntimeGlobals } from 'webpack';
|
|
3
3
|
import { fromNodeMiddleware, defineEventHandler } from 'h3';
|
|
4
4
|
import webpackDevMiddleware from 'webpack-dev-middleware';
|
|
5
5
|
import webpackHotMiddleware from 'webpack-hot-middleware';
|
|
@@ -155,6 +155,31 @@ ${options.globalPublicPath} = buildAssetsURL();
|
|
|
155
155
|
};
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
+
const pluginName = "ChunkErrorPlugin";
|
|
159
|
+
const script = `
|
|
160
|
+
if (typeof ${RuntimeGlobals.require} !== "undefined") {
|
|
161
|
+
var _ensureChunk = ${RuntimeGlobals.ensureChunk};
|
|
162
|
+
${RuntimeGlobals.ensureChunk} = function (chunkId) {
|
|
163
|
+
return Promise.resolve(_ensureChunk(chunkId)).catch(err => {
|
|
164
|
+
const e = new Event("nuxt.preloadError");
|
|
165
|
+
e.payload = err;
|
|
166
|
+
window.dispatchEvent(e);
|
|
167
|
+
throw err;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
};`;
|
|
171
|
+
class ChunkErrorPlugin {
|
|
172
|
+
apply(compiler) {
|
|
173
|
+
compiler.hooks.thisCompilation.tap(
|
|
174
|
+
pluginName,
|
|
175
|
+
(compilation) => compilation.mainTemplate.hooks.localVars.tap(
|
|
176
|
+
{ name: pluginName, stage: 1 },
|
|
177
|
+
(source) => source + script
|
|
178
|
+
)
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
158
183
|
function createMFS() {
|
|
159
184
|
const fs = createFsFromVolume(new Volume());
|
|
160
185
|
const _fs = { ...fs };
|
|
@@ -1103,6 +1128,9 @@ async function bundle(nuxt) {
|
|
|
1103
1128
|
config.plugins.push(DynamicBasePlugin.webpack({
|
|
1104
1129
|
sourcemap: nuxt.options.sourcemap[config.name]
|
|
1105
1130
|
}));
|
|
1131
|
+
if (config.name === "client" && nuxt.options.experimental.emitRouteChunkError) {
|
|
1132
|
+
config.plugins.push(new ChunkErrorPlugin());
|
|
1133
|
+
}
|
|
1106
1134
|
config.plugins.push(composableKeysPlugin.webpack({
|
|
1107
1135
|
sourcemap: nuxt.options.sourcemap[config.name],
|
|
1108
1136
|
rootDir: nuxt.options.rootDir
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/webpack-builder",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"repository": "nuxt/nuxt",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/core": "^7.20.12",
|
|
17
17
|
"@nuxt/friendly-errors-webpack-plugin": "^2.5.2",
|
|
18
|
-
"@nuxt/kit": "3.2.
|
|
18
|
+
"@nuxt/kit": "3.2.1",
|
|
19
19
|
"autoprefixer": "^10.4.13",
|
|
20
20
|
"css-loader": "^6.7.3",
|
|
21
21
|
"css-minimizer-webpack-plugin": "^4.2.2",
|
|
22
|
-
"cssnano": "^5.1.
|
|
23
|
-
"esbuild-loader": "^3.0.
|
|
22
|
+
"cssnano": "^5.1.15",
|
|
23
|
+
"esbuild-loader": "^3.0.1",
|
|
24
24
|
"escape-string-regexp": "^5.0.0",
|
|
25
25
|
"estree-walker": "^3.0.3",
|
|
26
26
|
"file-loader": "^6.2.0",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"fs-extra": "^11.1.0",
|
|
29
29
|
"hash-sum": "^2.0.0",
|
|
30
30
|
"lodash-es": "^4.17.21",
|
|
31
|
-
"magic-string": "^0.
|
|
31
|
+
"magic-string": "^0.29.0",
|
|
32
32
|
"memfs": "^3.4.13",
|
|
33
33
|
"mini-css-extract-plugin": "^2.7.2",
|
|
34
|
-
"mlly": "^1.1.
|
|
34
|
+
"mlly": "^1.1.1",
|
|
35
35
|
"ohash": "^1.0.0",
|
|
36
36
|
"pathe": "^1.1.0",
|
|
37
37
|
"pify": "^6.1.0",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"postcss-url": "^10.1.3",
|
|
42
42
|
"style-resources-loader": "^1.5.0",
|
|
43
43
|
"time-fix-plugin": "^2.0.7",
|
|
44
|
-
"ufo": "^1.0
|
|
45
|
-
"unplugin": "^1.0
|
|
44
|
+
"ufo": "^1.1.0",
|
|
45
|
+
"unplugin": "^1.1.0",
|
|
46
46
|
"url-loader": "^4.1.1",
|
|
47
|
-
"vue-bundle-renderer": "^1.0.
|
|
47
|
+
"vue-bundle-renderer": "^1.0.2",
|
|
48
48
|
"vue-loader": "^17.0.1",
|
|
49
49
|
"webpack": "^5.75.0",
|
|
50
|
-
"webpack-bundle-analyzer": "^4.
|
|
50
|
+
"webpack-bundle-analyzer": "^4.8.0",
|
|
51
51
|
"webpack-dev-middleware": "^6.0.1",
|
|
52
52
|
"webpack-hot-middleware": "^2.25.3",
|
|
53
53
|
"webpack-virtual-modules": "^0.5.0",
|
|
54
54
|
"webpackbar": "^5.0.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@nuxt/schema": "3.2.
|
|
57
|
+
"@nuxt/schema": "3.2.1",
|
|
58
58
|
"@types/lodash-es": "^4.17.6",
|
|
59
59
|
"@types/pify": "^5.0.1",
|
|
60
60
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vue": "^3.2.47"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
|
-
"node": "^14.
|
|
71
|
+
"node": "^14.18.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {}
|
|
74
74
|
}
|