@nuxt/webpack-builder 4.1.3 → 4.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/README.md +4 -4
- package/dist/index.mjs +26 -17
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
[](https://nuxt.com)
|
|
2
2
|
|
|
3
3
|
# Nuxt
|
|
4
4
|
|
|
5
5
|
<p>
|
|
6
6
|
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a>
|
|
8
|
-
<a href="https://github.com/nuxt/nuxt/
|
|
8
|
+
<a href="https://github.com/nuxt/nuxt/blob/main/LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
|
|
9
9
|
<a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
|
|
10
10
|
<a href="https://chat.nuxt.dev"><img src="https://img.shields.io/badge/Nuxt%20Discord-18181B?logo=discord" alt="Discord"></a>
|
|
11
11
|
<a href="https://securityscorecards.dev/"><img src="https://api.securityscorecards.dev/projects/github.com/nuxt/nuxt/badge" alt="Nuxt openssf scorecard score"></a>
|
|
@@ -109,9 +109,9 @@ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/
|
|
|
109
109
|
## <a name="follow-us">🔗 Follow Us</a>
|
|
110
110
|
|
|
111
111
|
<p valign="center">
|
|
112
|
-
<a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/
|
|
112
|
+
<a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/discord.svg" alt="Discord"></a> <a href="https://go.nuxt.com/x"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/twitter.svg" alt="Twitter"></a> <a href="https://go.nuxt.com/github"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/github.svg" alt="GitHub"></a> <a href="https://go.nuxt.com/bluesky"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/bluesky.svg" alt="Bluesky"></a>
|
|
113
113
|
</p>
|
|
114
114
|
|
|
115
115
|
## <a name="license">⚖️ License</a>
|
|
116
116
|
|
|
117
|
-
[MIT](https://github.com/nuxt/nuxt/
|
|
117
|
+
[MIT](https://github.com/nuxt/nuxt/blob/main/LICENSE)
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { logger, useNitro, useNuxt } from '@nuxt/kit';
|
|
|
8
8
|
import { createUnplugin } from 'unplugin';
|
|
9
9
|
import MagicString from 'magic-string';
|
|
10
10
|
import { webpack, WebpackBarPlugin, builder, MiniCssExtractPlugin, TsCheckerPlugin } from '#builder';
|
|
11
|
-
import { join, resolve, basename, normalize,
|
|
11
|
+
import { join, resolve, basename, normalize, isAbsolute } from 'pathe';
|
|
12
12
|
import { createFsFromVolume, Volume } from 'memfs';
|
|
13
13
|
import querystring from 'node:querystring';
|
|
14
14
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
@@ -24,8 +24,9 @@ import createResolver from 'postcss-import-resolver';
|
|
|
24
24
|
import { createJiti } from 'jiti';
|
|
25
25
|
import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js';
|
|
26
26
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
27
|
-
import { normalizeWebpackManifest } from 'vue-bundle-renderer';
|
|
27
|
+
import { normalizeWebpackManifest, precomputeDependencies } from 'vue-bundle-renderer';
|
|
28
28
|
import { hash } from 'ohash';
|
|
29
|
+
import { serialize } from 'seroval';
|
|
29
30
|
|
|
30
31
|
const defaults = {
|
|
31
32
|
globalPublicPath: "__webpack_public_path__",
|
|
@@ -475,6 +476,17 @@ function getEnv(ctx) {
|
|
|
475
476
|
"import.meta.client": ctx.isClient,
|
|
476
477
|
"import.meta.server": ctx.isServer
|
|
477
478
|
};
|
|
479
|
+
if (ctx.isClient) {
|
|
480
|
+
_env["process.prerender"] = false;
|
|
481
|
+
_env["process.nitro"] = false;
|
|
482
|
+
_env["import.meta.prerender"] = false;
|
|
483
|
+
_env["import.meta.nitro"] = false;
|
|
484
|
+
} else {
|
|
485
|
+
_env["process.prerender"] = "(()=>process.prerender)()";
|
|
486
|
+
_env["process.nitro"] = "(()=>process.nitro)()";
|
|
487
|
+
_env["import.meta.prerender"] = "(()=>import.meta.prerender)()";
|
|
488
|
+
_env["import.meta.nitro"] = "(()=>import.meta.nitro)()";
|
|
489
|
+
}
|
|
478
490
|
if (ctx.userConfig.aggressiveCodeRemoval) {
|
|
479
491
|
_env["typeof process"] = JSON.stringify(ctx.isServer ? "object" : "undefined");
|
|
480
492
|
_env["typeof window"] = _env["typeof document"] = JSON.stringify(!ctx.isServer ? "object" : "undefined");
|
|
@@ -703,11 +715,11 @@ async function createPostcssLoadersRule(ctx) {
|
|
|
703
715
|
}
|
|
704
716
|
|
|
705
717
|
class VueSSRClientPlugin {
|
|
706
|
-
|
|
718
|
+
serverDist;
|
|
719
|
+
nuxt;
|
|
707
720
|
constructor(options) {
|
|
708
|
-
this.
|
|
709
|
-
|
|
710
|
-
}, options);
|
|
721
|
+
this.serverDist = resolve(options.nuxt.options.buildDir, "dist/server");
|
|
722
|
+
this.nuxt = options.nuxt;
|
|
711
723
|
}
|
|
712
724
|
apply(compiler) {
|
|
713
725
|
compiler.hooks.afterEmit.tap("VueSSRClientPlugin", async (compilation) => {
|
|
@@ -798,12 +810,12 @@ class VueSSRClientPlugin {
|
|
|
798
810
|
}
|
|
799
811
|
}
|
|
800
812
|
const manifest = normalizeWebpackManifest(webpackManifest);
|
|
801
|
-
await this.
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
await writeFile(this.
|
|
805
|
-
|
|
806
|
-
await writeFile(this.
|
|
813
|
+
await this.nuxt.callHook("build:manifest", manifest);
|
|
814
|
+
await mkdir(this.serverDist, { recursive: true });
|
|
815
|
+
const precomputed = precomputeDependencies(manifest);
|
|
816
|
+
await writeFile(join(this.serverDist, `client.manifest.json`), JSON.stringify(manifest, null, 2));
|
|
817
|
+
await writeFile(join(this.serverDist, "client.manifest.mjs"), "export default " + serialize(manifest), "utf8");
|
|
818
|
+
await writeFile(join(this.serverDist, "client.precomputed.mjs"), "export default " + serialize(precomputed), "utf8");
|
|
807
819
|
});
|
|
808
820
|
}
|
|
809
821
|
}
|
|
@@ -885,10 +897,7 @@ function vue(ctx) {
|
|
|
885
897
|
options: ctx.userConfig.loaders.vue
|
|
886
898
|
});
|
|
887
899
|
if (ctx.isClient) {
|
|
888
|
-
ctx.config.plugins.push(new VueSSRClientPlugin({
|
|
889
|
-
filename: resolve(ctx.options.buildDir, "dist/server", `${ctx.name}.manifest.json`),
|
|
890
|
-
nuxt: ctx.nuxt
|
|
891
|
-
}));
|
|
900
|
+
ctx.config.plugins.push(new VueSSRClientPlugin({ nuxt: ctx.nuxt }));
|
|
892
901
|
} else {
|
|
893
902
|
ctx.config.plugins.push(new VueSSRServerPlugin({
|
|
894
903
|
filename: `${ctx.name}.manifest.json`
|
|
@@ -978,7 +987,7 @@ function clientHMR(ctx) {
|
|
|
978
987
|
const hotMiddlewareClientOptionsStr = querystring.stringify(hotMiddlewareClientOptions);
|
|
979
988
|
const app = ctx.config.entry.app;
|
|
980
989
|
app.unshift(
|
|
981
|
-
// https://github.com/
|
|
990
|
+
// https://github.com/webpack/webpack-hot-middleware#config
|
|
982
991
|
`webpack-hot-middleware/client?${hotMiddlewareClientOptionsStr}`
|
|
983
992
|
);
|
|
984
993
|
ctx.config.plugins ||= [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/webpack-builder",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"autoprefixer": "^10.4.21",
|
|
31
31
|
"css-loader": "^7.1.2",
|
|
32
32
|
"css-minimizer-webpack-plugin": "^7.0.2",
|
|
33
|
-
"cssnano": "^7.1.
|
|
33
|
+
"cssnano": "^7.1.2",
|
|
34
34
|
"defu": "^6.1.4",
|
|
35
35
|
"esbuild-loader": "^4.4.0",
|
|
36
36
|
"escape-string-regexp": "^5.0.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"h3": "^1.15.4",
|
|
40
40
|
"jiti": "^2.6.1",
|
|
41
41
|
"knitwork": "^1.2.0",
|
|
42
|
-
"magic-string": "^0.30.
|
|
43
|
-
"memfs": "^4.
|
|
42
|
+
"magic-string": "^0.30.21",
|
|
43
|
+
"memfs": "^4.50.0",
|
|
44
44
|
"mini-css-extract-plugin": "^2.9.4",
|
|
45
45
|
"ohash": "^2.0.11",
|
|
46
46
|
"pathe": "^2.0.3",
|
|
@@ -51,30 +51,31 @@
|
|
|
51
51
|
"postcss-loader": "^8.2.0",
|
|
52
52
|
"postcss-url": "^10.1.3",
|
|
53
53
|
"pug-plain-loader": "^1.1.0",
|
|
54
|
-
"
|
|
54
|
+
"seroval": "^1.3.2",
|
|
55
|
+
"std-env": "^3.10.0",
|
|
55
56
|
"time-fix-plugin": "^2.0.7",
|
|
56
57
|
"tinyglobby": "^0.2.15",
|
|
57
58
|
"ufo": "^1.6.1",
|
|
58
|
-
"unenv": "^2.0.0-rc.
|
|
59
|
+
"unenv": "^2.0.0-rc.24",
|
|
59
60
|
"unplugin": "^2.3.10",
|
|
60
61
|
"url-loader": "^4.1.1",
|
|
61
62
|
"vue-bundle-renderer": "^2.2.0",
|
|
62
63
|
"vue-loader": "^17.4.2",
|
|
63
|
-
"webpack": "^5.102.
|
|
64
|
+
"webpack": "^5.102.1",
|
|
64
65
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
65
66
|
"webpack-dev-middleware": "^7.4.5",
|
|
66
67
|
"webpack-hot-middleware": "^2.26.1",
|
|
67
68
|
"webpackbar": "^7.0.0",
|
|
68
|
-
"@nuxt/kit": "4.1
|
|
69
|
+
"@nuxt/kit": "4.2.1"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
|
-
"@rspack/core": "1.
|
|
72
|
+
"@rspack/core": "1.6.1",
|
|
72
73
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
73
|
-
"@types/webpack-hot-middleware": "2.25.
|
|
74
|
-
"rollup": "4.52.
|
|
74
|
+
"@types/webpack-hot-middleware": "2.25.12",
|
|
75
|
+
"rollup": "4.52.5",
|
|
75
76
|
"unbuild": "3.6.1",
|
|
76
|
-
"vue": "3.5.
|
|
77
|
-
"@nuxt/schema": "4.1
|
|
77
|
+
"vue": "3.5.23",
|
|
78
|
+
"@nuxt/schema": "4.2.1"
|
|
78
79
|
},
|
|
79
80
|
"peerDependencies": {
|
|
80
81
|
"vue": "^3.3.4"
|