@nuxt/webpack-builder 4.1.2 → 4.2.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/README.md +5 -5
- package/dist/index.mjs +26 -17
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Example of an `app.vue`:
|
|
|
60
60
|
<script setup lang="ts">
|
|
61
61
|
useSeoMeta({
|
|
62
62
|
title: 'Meet Nuxt',
|
|
63
|
-
description: 'The Intuitive Vue Framework.'
|
|
63
|
+
description: 'The Intuitive Vue Framework.',
|
|
64
64
|
})
|
|
65
65
|
</script>
|
|
66
66
|
|
|
@@ -93,13 +93,13 @@ Discover our [list of modules](https://nuxt.com/modules) to supercharge your Nux
|
|
|
93
93
|
We invite you to contribute and help improve Nuxt 💚
|
|
94
94
|
|
|
95
95
|
Here are a few ways you can get involved:
|
|
96
|
-
- **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/community/reporting-bugs) to learn how to submit a bug report.
|
|
97
|
-
- **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/community/contribution) to share your suggestions.
|
|
98
|
-
- **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/community/getting-help) provides resources to help you out.
|
|
96
|
+
- **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/4.x/community/reporting-bugs) to learn how to submit a bug report.
|
|
97
|
+
- **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/4.x/community/contribution) to share your suggestions.
|
|
98
|
+
- **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/4.x/community/getting-help) provides resources to help you out.
|
|
99
99
|
|
|
100
100
|
## <a name="local-development">🏠 Local Development</a>
|
|
101
101
|
|
|
102
|
-
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#setup) to contribute to the framework and documentation.
|
|
102
|
+
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/4.x/community/framework-contribution#setup) to contribute to the framework and documentation.
|
|
103
103
|
|
|
104
104
|
## <a name="professional-support">🛟 Professional Support</a>
|
|
105
105
|
|
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`
|
|
@@ -1245,7 +1254,7 @@ async function compile(compiler) {
|
|
|
1245
1254
|
if (nuxt.options.dev) {
|
|
1246
1255
|
const compilersWatching = [];
|
|
1247
1256
|
nuxt.hook("close", async () => {
|
|
1248
|
-
await Promise.all(compilersWatching.map((watching) => pify(watching.close.bind(watching))()));
|
|
1257
|
+
await Promise.all(compilersWatching.map((watching) => watching && pify(watching.close.bind(watching))()));
|
|
1249
1258
|
});
|
|
1250
1259
|
if (compiler.options.name === "client") {
|
|
1251
1260
|
return new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/webpack-builder",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"css-minimizer-webpack-plugin": "^7.0.2",
|
|
33
33
|
"cssnano": "^7.1.1",
|
|
34
34
|
"defu": "^6.1.4",
|
|
35
|
-
"esbuild-loader": "^4.
|
|
35
|
+
"esbuild-loader": "^4.4.0",
|
|
36
36
|
"escape-string-regexp": "^5.0.0",
|
|
37
37
|
"file-loader": "^6.2.0",
|
|
38
38
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
39
39
|
"h3": "^1.15.4",
|
|
40
|
-
"jiti": "^2.
|
|
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.49.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.22",
|
|
59
60
|
"unplugin": "^2.3.10",
|
|
60
61
|
"url-loader": "^4.1.1",
|
|
61
|
-
"vue-bundle-renderer": "^2.
|
|
62
|
+
"vue-bundle-renderer": "^2.2.0",
|
|
62
63
|
"vue-loader": "^17.4.2",
|
|
63
|
-
"webpack": "^5.
|
|
64
|
+
"webpack": "^5.102.1",
|
|
64
65
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
65
|
-
"webpack-dev-middleware": "^7.4.
|
|
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.
|
|
69
|
+
"@nuxt/kit": "4.2.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
|
-
"@rspack/core": "1.5.
|
|
72
|
+
"@rspack/core": "1.5.8",
|
|
72
73
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
73
|
-
"@types/webpack-hot-middleware": "2.25.
|
|
74
|
-
"rollup": "4.
|
|
74
|
+
"@types/webpack-hot-middleware": "2.25.11",
|
|
75
|
+
"rollup": "4.52.5",
|
|
75
76
|
"unbuild": "3.6.1",
|
|
76
|
-
"vue": "3.5.
|
|
77
|
-
"@nuxt/schema": "4.
|
|
77
|
+
"vue": "3.5.22",
|
|
78
|
+
"@nuxt/schema": "4.2.0"
|
|
78
79
|
},
|
|
79
80
|
"peerDependencies": {
|
|
80
81
|
"vue": "^3.3.4"
|