@nuxt/rspack-builder 3.19.3 → 3.20.0
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 +25 -16
- package/package.json +6 -5
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, normalize,
|
|
11
|
+
import { join, resolve, 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__",
|
|
@@ -472,6 +473,17 @@ function getEnv(ctx) {
|
|
|
472
473
|
"import.meta.client": ctx.isClient,
|
|
473
474
|
"import.meta.server": ctx.isServer
|
|
474
475
|
};
|
|
476
|
+
if (ctx.isClient) {
|
|
477
|
+
_env["process.prerender"] = false;
|
|
478
|
+
_env["process.nitro"] = false;
|
|
479
|
+
_env["import.meta.prerender"] = false;
|
|
480
|
+
_env["import.meta.nitro"] = false;
|
|
481
|
+
} else {
|
|
482
|
+
_env["process.prerender"] = "(()=>process.prerender)()";
|
|
483
|
+
_env["process.nitro"] = "(()=>process.nitro)()";
|
|
484
|
+
_env["import.meta.prerender"] = "(()=>import.meta.prerender)()";
|
|
485
|
+
_env["import.meta.nitro"] = "(()=>import.meta.nitro)()";
|
|
486
|
+
}
|
|
475
487
|
if (ctx.userConfig.aggressiveCodeRemoval) {
|
|
476
488
|
_env["typeof process"] = JSON.stringify(ctx.isServer ? "object" : "undefined");
|
|
477
489
|
_env["typeof window"] = _env["typeof document"] = JSON.stringify(!ctx.isServer ? "object" : "undefined");
|
|
@@ -700,11 +712,11 @@ async function createPostcssLoadersRule(ctx) {
|
|
|
700
712
|
}
|
|
701
713
|
|
|
702
714
|
class VueSSRClientPlugin {
|
|
703
|
-
|
|
715
|
+
serverDist;
|
|
716
|
+
nuxt;
|
|
704
717
|
constructor(options) {
|
|
705
|
-
this.
|
|
706
|
-
|
|
707
|
-
}, options);
|
|
718
|
+
this.serverDist = resolve(options.nuxt.options.buildDir, "dist/server");
|
|
719
|
+
this.nuxt = options.nuxt;
|
|
708
720
|
}
|
|
709
721
|
apply(compiler) {
|
|
710
722
|
compiler.hooks.afterEmit.tap("VueSSRClientPlugin", async (compilation) => {
|
|
@@ -795,12 +807,12 @@ class VueSSRClientPlugin {
|
|
|
795
807
|
}
|
|
796
808
|
}
|
|
797
809
|
const manifest = normalizeWebpackManifest(webpackManifest);
|
|
798
|
-
await this.
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
await writeFile(this.
|
|
802
|
-
|
|
803
|
-
await writeFile(this.
|
|
810
|
+
await this.nuxt.callHook("build:manifest", manifest);
|
|
811
|
+
await mkdir(this.serverDist, { recursive: true });
|
|
812
|
+
const precomputed = precomputeDependencies(manifest);
|
|
813
|
+
await writeFile(join(this.serverDist, `client.manifest.json`), JSON.stringify(manifest, null, 2));
|
|
814
|
+
await writeFile(join(this.serverDist, "client.manifest.mjs"), "export default " + serialize(manifest), "utf8");
|
|
815
|
+
await writeFile(join(this.serverDist, "client.precomputed.mjs"), "export default " + serialize(precomputed), "utf8");
|
|
804
816
|
});
|
|
805
817
|
}
|
|
806
818
|
}
|
|
@@ -882,10 +894,7 @@ function vue(ctx) {
|
|
|
882
894
|
options: ctx.userConfig.loaders.vue
|
|
883
895
|
});
|
|
884
896
|
if (ctx.isClient) {
|
|
885
|
-
ctx.config.plugins.push(new VueSSRClientPlugin({
|
|
886
|
-
filename: resolve(ctx.options.buildDir, "dist/server", `${ctx.name}.manifest.json`),
|
|
887
|
-
nuxt: ctx.nuxt
|
|
888
|
-
}));
|
|
897
|
+
ctx.config.plugins.push(new VueSSRClientPlugin({ nuxt: ctx.nuxt }));
|
|
889
898
|
} else {
|
|
890
899
|
ctx.config.plugins.push(new VueSSRServerPlugin({
|
|
891
900
|
filename: `${ctx.name}.manifest.json`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/rspack-builder",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"jiti": "^2.6.1",
|
|
41
41
|
"knitwork": "^1.2.0",
|
|
42
42
|
"magic-string": "^0.30.19",
|
|
43
|
-
"memfs": "^4.
|
|
43
|
+
"memfs": "^4.49.0",
|
|
44
44
|
"ohash": "^2.0.11",
|
|
45
45
|
"pathe": "^2.0.3",
|
|
46
46
|
"pify": "^6.1.0",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"postcss-loader": "^8.2.0",
|
|
51
51
|
"postcss-url": "^10.1.3",
|
|
52
52
|
"pug-plain-loader": "^1.1.0",
|
|
53
|
+
"seroval": "^1.3.2",
|
|
53
54
|
"std-env": "^3.9.0",
|
|
54
55
|
"time-fix-plugin": "^2.0.7",
|
|
55
56
|
"ts-checker-rspack-plugin": "^1.1.5",
|
|
@@ -63,16 +64,16 @@
|
|
|
63
64
|
"webpack-dev-middleware": "^7.4.5",
|
|
64
65
|
"webpack-hot-middleware": "^2.26.1",
|
|
65
66
|
"webpackbar": "^7.0.0",
|
|
66
|
-
"@nuxt/kit": "3.
|
|
67
|
+
"@nuxt/kit": "3.20.0"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@types/pify": "6.1.0",
|
|
70
71
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
71
|
-
"@types/webpack-hot-middleware": "2.25.
|
|
72
|
+
"@types/webpack-hot-middleware": "2.25.12",
|
|
72
73
|
"rollup": "4.52.4",
|
|
73
74
|
"unbuild": "3.6.1",
|
|
74
75
|
"vue": "3.5.22",
|
|
75
|
-
"@nuxt/schema": "3.
|
|
76
|
+
"@nuxt/schema": "3.20.0"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
79
|
"vue": "^3.3.4"
|