@nuxt/webpack-builder-nightly 4.3.0-29437273.f9c092c5 → 4.3.0-29439260.653f364a

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 +54 -5
  2. package/package.json +6 -3
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import webpackDevMiddleware from 'webpack-dev-middleware';
4
4
  import webpackHotMiddleware from 'webpack-hot-middleware';
5
5
  import { defu } from 'defu';
6
6
  import { joinURL } from 'ufo';
7
- import { logger, useNitro, useNuxt } from '@nuxt/kit';
7
+ import { logger, tryImportModule, directoryToURL, resolveAlias, 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';
@@ -27,6 +27,9 @@ import { mkdir, writeFile } from 'node:fs/promises';
27
27
  import { normalizeWebpackManifest, precomputeDependencies } from 'vue-bundle-renderer';
28
28
  import { hash } from 'ohash';
29
29
  import { serialize } from 'seroval';
30
+ import { parseNodeModulePath } from 'mlly';
31
+ import { resolveModulePath } from 'exsolve';
32
+ import { runtimeDependencies } from 'nuxt/meta';
30
33
 
31
34
  const defaults = {
32
35
  globalPublicPath: "__webpack_public_path__",
@@ -1049,6 +1052,7 @@ function node(ctx) {
1049
1052
  }
1050
1053
 
1051
1054
  const assetPattern = /\.(?:css|s[ca]ss|png|jpe?g|gif|svg|woff2?|eot|ttf|otf|webp|webm|mp4|ogv)(?:\?.*)?$/i;
1055
+ const VIRTUAL_RE = /^\0?virtual:(?:nuxt:)?/;
1052
1056
  async function server(ctx) {
1053
1057
  ctx.name = "server";
1054
1058
  ctx.isServer = true;
@@ -1064,7 +1068,7 @@ function serverPreset(ctx) {
1064
1068
  ctx.config.output.filename = "server.mjs";
1065
1069
  if (ctx.nuxt.options.sourcemap.server) {
1066
1070
  const prefix = ctx.nuxt.options.sourcemap.server === "hidden" ? "hidden-" : "";
1067
- ctx.config.devtool = prefix + ctx.isDev ? "cheap-module-source-map" : "source-map";
1071
+ ctx.config.devtool = prefix + (ctx.isDev ? "cheap-module-source-map" : "source-map");
1068
1072
  } else {
1069
1073
  ctx.config.devtool = false;
1070
1074
  }
@@ -1072,8 +1076,11 @@ function serverPreset(ctx) {
1072
1076
  splitChunks: false,
1073
1077
  minimize: false
1074
1078
  };
1079
+ if (ctx.isDev) {
1080
+ ctx.config.output.asyncChunks = false;
1081
+ }
1075
1082
  }
1076
- function serverStandalone(ctx) {
1083
+ async function serverStandalone(ctx) {
1077
1084
  const inline = [
1078
1085
  "src/",
1079
1086
  "#app",
@@ -1087,13 +1094,24 @@ function serverStandalone(ctx) {
1087
1094
  "#",
1088
1095
  ...ctx.options.build.transpile
1089
1096
  ];
1097
+ const { runtimeDependencies: runtimeNitroDependencies = [] } = await tryImportModule("nitropack/runtime/meta", {
1098
+ url: new URL(import.meta.url)
1099
+ }) || {};
1090
1100
  const external = /* @__PURE__ */ new Set([
1091
1101
  "nitro/runtime",
1092
1102
  // TODO: remove in v5
1093
1103
  "#internal/nitro",
1094
1104
  "nitropack/runtime",
1095
1105
  "#shared",
1096
- resolve(ctx.nuxt.options.rootDir, ctx.nuxt.options.dir.shared)
1106
+ resolve(ctx.nuxt.options.rootDir, ctx.nuxt.options.dir.shared),
1107
+ // explicit dependencies we use in our ssr renderer
1108
+ "unhead",
1109
+ "@unhead/vue",
1110
+ "@nuxt/devalue",
1111
+ "rou3",
1112
+ "unstorage",
1113
+ ...runtimeDependencies,
1114
+ ...runtimeNitroDependencies
1097
1115
  ]);
1098
1116
  if (!ctx.nuxt.options.dev) {
1099
1117
  external.add("#internal/nuxt/paths");
@@ -1103,16 +1121,47 @@ function serverStandalone(ctx) {
1103
1121
  if (!Array.isArray(ctx.config.externals)) {
1104
1122
  return;
1105
1123
  }
1106
- ctx.config.externals.push(({ request }, cb) => {
1124
+ const conditions = [
1125
+ ctx.nuxt.options.dev ? "development" : "production",
1126
+ "node",
1127
+ "import",
1128
+ "require"
1129
+ ];
1130
+ ctx.config.externals.push(({ request, context }, cb) => {
1107
1131
  if (!request) {
1108
1132
  return cb(void 0, false);
1109
1133
  }
1110
1134
  if (external.has(request)) {
1135
+ const resolved = resolveModulePath(request, {
1136
+ from: context ? [context, ...ctx.nuxt.options.modulesDir].map((d) => directoryToURL(d)) : ctx.nuxt.options.modulesDir.map((d) => directoryToURL(d)),
1137
+ suffixes: ["", "index"],
1138
+ conditions,
1139
+ try: true
1140
+ });
1141
+ if (resolved && isAbsolute(resolved)) {
1142
+ return cb(void 0, resolved);
1143
+ }
1111
1144
  return cb(void 0, true);
1112
1145
  }
1113
1146
  if (request[0] === "." || isAbsolute(request) || inline.find((prefix) => typeof prefix === "string" && request.startsWith(prefix)) || assetPattern.test(request)) {
1114
1147
  return cb(void 0, false);
1115
1148
  }
1149
+ if (context && request && !request.startsWith("node:") && (isAbsolute(context) || VIRTUAL_RE.test(context))) {
1150
+ try {
1151
+ const normalisedRequest = resolveAlias(normalize(request), ctx.nuxt.options.alias);
1152
+ const dir = parseNodeModulePath(context).dir || ctx.nuxt.options.rootDir;
1153
+ const resolved = resolveModulePath(normalisedRequest, {
1154
+ from: [dir, ...ctx.nuxt.options.modulesDir].map((d) => directoryToURL(d)),
1155
+ suffixes: ["", "index"],
1156
+ conditions,
1157
+ try: true
1158
+ });
1159
+ if (resolved && isAbsolute(resolved)) {
1160
+ return cb(void 0, false);
1161
+ }
1162
+ } catch {
1163
+ }
1164
+ }
1116
1165
  return cb(void 0, true);
1117
1166
  });
1118
1167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "4.3.0-29437273.f9c092c5",
3
+ "version": "4.3.0-29439260.653f364a",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
30
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29437273.f9c092c5",
30
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29439260.653f364a",
31
31
  "autoprefixer": "^10.4.23",
32
32
  "css-loader": "^7.1.2",
33
33
  "css-minimizer-webpack-plugin": "^7.0.4",
@@ -35,6 +35,7 @@
35
35
  "defu": "^6.1.4",
36
36
  "esbuild-loader": "^4.4.0",
37
37
  "escape-string-regexp": "^5.0.0",
38
+ "exsolve": "^1.0.8",
38
39
  "file-loader": "^6.2.0",
39
40
  "fork-ts-checker-webpack-plugin": "^9.1.0",
40
41
  "h3": "^1.15.4",
@@ -43,6 +44,7 @@
43
44
  "magic-string": "^0.30.21",
44
45
  "memfs": "^4.51.1",
45
46
  "mini-css-extract-plugin": "^2.9.4",
47
+ "mlly": "^1.8.0",
46
48
  "ohash": "^2.0.11",
47
49
  "pathe": "^2.0.3",
48
50
  "pify": "^6.1.0",
@@ -69,7 +71,7 @@
69
71
  "webpackbar": "^7.0.0"
70
72
  },
71
73
  "devDependencies": {
72
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29437273.f9c092c5",
74
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29439260.653f364a",
73
75
  "@rspack/core": "1.6.7",
74
76
  "@types/webpack-bundle-analyzer": "4.7.0",
75
77
  "@types/webpack-hot-middleware": "2.25.12",
@@ -78,6 +80,7 @@
78
80
  "vue": "3.5.25"
79
81
  },
80
82
  "peerDependencies": {
83
+ "nuxt": "npm:nuxt-nightly@4.3.0-29439260.653f364a",
81
84
  "vue": "^3.3.4"
82
85
  },
83
86
  "engines": {