@nuxt/webpack-builder 3.9.3 → 3.10.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.
Files changed (2) hide show
  1. package/dist/index.mjs +19 -2
  2. package/package.json +15 -14
package/dist/index.mjs CHANGED
@@ -19,6 +19,7 @@ import VirtualModulesPlugin from 'webpack-virtual-modules';
19
19
  import querystring from 'node:querystring';
20
20
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
21
21
  import ForkTSCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
22
+ import { env, nodeless } from 'unenv';
22
23
  import { cloneDeep } from 'lodash-es';
23
24
  import TimeFixPlugin from 'time-fix-plugin';
24
25
  import WebpackBar from 'webpackbar';
@@ -150,7 +151,8 @@ const composableKeysPlugin = createUnplugin((options) => {
150
151
  }
151
152
  break;
152
153
  }
153
- const endsWithComma = code.slice(codeIndex + node.start, codeIndex + node.end - 1).trim().endsWith(",");
154
+ const newCode = code.slice(codeIndex + node.start, codeIndex + node.end - 1).trim();
155
+ const endsWithComma = newCode[newCode.length - 1] === ",";
154
156
  s.appendLeft(
155
157
  codeIndex + node.end - 1,
156
158
  (node.arguments.length && !endsWithComma ? ", " : "") + "'$" + hash(`${relativeID}-${++count}`) + "'"
@@ -1076,7 +1078,8 @@ function client(ctx) {
1076
1078
  clientOptimization,
1077
1079
  clientDevtool,
1078
1080
  clientPerformance,
1079
- clientHMR
1081
+ clientHMR,
1082
+ clientNodeCompat
1080
1083
  ]);
1081
1084
  }
1082
1085
  function clientDevtool(ctx) {
@@ -1098,6 +1101,20 @@ function clientPerformance(ctx) {
1098
1101
  ...ctx.config.performance
1099
1102
  };
1100
1103
  }
1104
+ function clientNodeCompat(ctx) {
1105
+ if (!ctx.nuxt.options.experimental.clientNodeCompat) {
1106
+ return;
1107
+ }
1108
+ ctx.config.plugins.push(new webpack.DefinePlugin({ global: "globalThis" }));
1109
+ ctx.config.resolve = ctx.config.resolve || {};
1110
+ ctx.config.resolve.fallback = {
1111
+ ...env(nodeless).alias,
1112
+ ...ctx.config.resolve.fallback
1113
+ };
1114
+ ctx.config.plugins.unshift(new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
1115
+ resource.request = resource.request.replace(/^node:/, "");
1116
+ }));
1117
+ }
1101
1118
  function clientHMR(ctx) {
1102
1119
  if (!ctx.isDev) {
1103
1120
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder",
3
- "version": "3.9.3",
3
+ "version": "3.10.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -23,23 +23,23 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
26
- "autoprefixer": "^10.4.16",
27
- "css-loader": "^6.9.0",
28
- "css-minimizer-webpack-plugin": "^5.0.1",
26
+ "autoprefixer": "^10.4.17",
27
+ "css-loader": "^6.10.0",
28
+ "css-minimizer-webpack-plugin": "^6.0.0",
29
29
  "cssnano": "^6.0.3",
30
30
  "defu": "^6.1.4",
31
- "esbuild-loader": "^4.0.2",
31
+ "esbuild-loader": "^4.0.3",
32
32
  "escape-string-regexp": "^5.0.0",
33
33
  "estree-walker": "^3.0.3",
34
34
  "file-loader": "^6.2.0",
35
35
  "fork-ts-checker-webpack-plugin": "^9.0.2",
36
36
  "fs-extra": "^11.2.0",
37
- "h3": "^1.10.0",
37
+ "h3": "^1.10.1",
38
38
  "hash-sum": "^2.0.0",
39
39
  "lodash-es": "4.17.21",
40
- "magic-string": "^0.30.5",
40
+ "magic-string": "^0.30.6",
41
41
  "memfs": "^4.6.0",
42
- "mini-css-extract-plugin": "^2.7.7",
42
+ "mini-css-extract-plugin": "^2.8.0",
43
43
  "mlly": "^1.5.0",
44
44
  "ohash": "^1.1.3",
45
45
  "pathe": "^1.1.2",
@@ -47,23 +47,24 @@
47
47
  "postcss": "^8.4.33",
48
48
  "postcss-import": "^16.0.0",
49
49
  "postcss-import-resolver": "^2.0.0",
50
- "postcss-loader": "^8.0.0",
50
+ "postcss-loader": "^8.1.0",
51
51
  "postcss-url": "^10.1.3",
52
52
  "pug-plain-loader": "^1.1.0",
53
53
  "std-env": "^3.7.0",
54
54
  "time-fix-plugin": "^2.0.7",
55
55
  "ufo": "^1.3.2",
56
+ "unenv": "^1.9.0",
56
57
  "unplugin": "^1.6.0",
57
58
  "url-loader": "^4.1.1",
58
59
  "vue-bundle-renderer": "^2.0.0",
59
60
  "vue-loader": "^17.4.2",
60
- "webpack": "^5.89.0",
61
+ "webpack": "^5.90.1",
61
62
  "webpack-bundle-analyzer": "^4.10.1",
62
63
  "webpack-dev-middleware": "^7.0.0",
63
- "webpack-hot-middleware": "^2.26.0",
64
+ "webpack-hot-middleware": "^2.26.1",
64
65
  "webpack-virtual-modules": "^0.6.1",
65
66
  "webpackbar": "^6.0.0",
66
- "@nuxt/kit": "3.9.3"
67
+ "@nuxt/kit": "3.10.1"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@types/fs-extra": "11.0.4",
@@ -73,8 +74,8 @@
73
74
  "@types/webpack-hot-middleware": "2.25.9",
74
75
  "@types/webpack-virtual-modules": "0.1.3",
75
76
  "unbuild": "latest",
76
- "vue": "3.4.14",
77
- "@nuxt/schema": "3.9.3"
77
+ "vue": "3.4.15",
78
+ "@nuxt/schema": "3.10.1"
78
79
  },
79
80
  "peerDependencies": {
80
81
  "vue": "^3.3.4"