@nuxt/webpack-builder-nightly 5.0.0-29644678.e6ccdeb8 → 5.0.0-29644680.78bc1fc6

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 +18 -7
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { defu } from "defu";
6
6
  import { joinURL, withTrailingSlash } from "ufo";
7
7
  import { directoryToURL, logger, resolveAlias, useNitro, useNuxt } from "@nuxt/kit";
8
8
  import { createUnplugin } from "unplugin";
9
- import { generateTransform, rolldownString } from "rolldown-string";
9
+ import MagicString from "magic-string";
10
10
  import { MiniCssExtractPlugin, TsCheckerPlugin, WebpackBarPlugin, builder, webpack } from "#builder";
11
11
  import { existsSync, readFileSync } from "node:fs";
12
12
  import { basename, isAbsolute, join, normalize, relative, resolve } from "pathe";
@@ -31,8 +31,16 @@ import { normalizeWebpackManifest, precomputeDependencies } from "vue-bundle-ren
31
31
  import { hash } from "ohash";
32
32
  import { serialize } from "seroval";
33
33
  import { parseNodeModulePath } from "mlly";
34
+ const defaults = {
35
+ globalPublicPath: "__webpack_public_path__",
36
+ sourcemap: true
37
+ };
34
38
  const ENTRY_RE = /import ["']#build\/css["'];/;
35
- const DynamicBasePlugin = createUnplugin(() => {
39
+ const DynamicBasePlugin = createUnplugin((options = {}) => {
40
+ options = {
41
+ ...defaults,
42
+ ...options
43
+ };
36
44
  return {
37
45
  name: "nuxt:dynamic-base-path",
38
46
  enforce: "post",
@@ -41,10 +49,13 @@ const DynamicBasePlugin = createUnplugin(() => {
41
49
  id: { include: /entry/ },
42
50
  code: { include: ENTRY_RE }
43
51
  },
44
- handler(code, id, meta) {
45
- const s = rolldownString(code, id, meta);
46
- s.prepend(`import { buildAssetsURL } from '#internal/nuxt/paths';\n__webpack_public_path__ = buildAssetsURL();\n`);
47
- return generateTransform(s, id);
52
+ handler(code) {
53
+ const s = new MagicString(code);
54
+ s.prepend(`import { buildAssetsURL } from '#internal/nuxt/paths';\n${options.globalPublicPath} = buildAssetsURL();\n`);
55
+ return {
56
+ code: s.toString(),
57
+ map: options.sourcemap ? s.generateMap({ hires: true }) : void 0
58
+ };
48
59
  }
49
60
  }
50
61
  };
@@ -1347,7 +1358,7 @@ const bundle = async (nuxt) => {
1347
1358
  const mfs = nuxt.options.dev ? createMFS() : null;
1348
1359
  const ssrStylesPlugin = nuxt.options.ssr && !nuxt.options.dev ? new SSRStylesPlugin(nuxt) : null;
1349
1360
  for (const config of webpackConfigs) {
1350
- config.plugins.push(DynamicBasePlugin.webpack());
1361
+ config.plugins.push(DynamicBasePlugin.webpack({ sourcemap: !!nuxt.options.sourcemap[config.name] }));
1351
1362
  if (config.name === "client" && nuxt.options.experimental.emitRouteChunkError && nuxt.options.builder !== "@nuxt/rspack-builder") config.plugins.push(new ChunkErrorPlugin());
1352
1363
  if (ssrStylesPlugin) config.plugins.push(ssrStylesPlugin);
1353
1364
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "5.0.0-29644678.e6ccdeb8",
3
+ "version": "5.0.0-29644680.78bc1fc6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
28
- "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29644678.e6ccdeb8",
28
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29644680.78bc1fc6",
29
29
  "@vue/compiler-sfc": "3.5.34",
30
30
  "autoprefixer": "^10.5.0",
31
31
  "css-loader": "^7.1.4",
@@ -39,6 +39,7 @@
39
39
  "fork-ts-checker-webpack-plugin": "^9.1.0",
40
40
  "jiti": "^2.7.0",
41
41
  "knitwork": "^1.3.0",
42
+ "magic-string": "^0.30.21",
42
43
  "memfs": "^4.57.2",
43
44
  "mini-css-extract-plugin": "^2.10.2",
44
45
  "mlly": "^1.8.2",
@@ -51,7 +52,6 @@
51
52
  "postcss-loader": "^8.2.1",
52
53
  "postcss-url": "^10.1.3",
53
54
  "pug-plain-loader": "^1.1.0",
54
- "rolldown-string": "^0.3.0",
55
55
  "seroval": "^1.5.4",
56
56
  "time-fix-plugin": "^2.0.7",
57
57
  "tinyglobby": "^0.2.16",
@@ -68,7 +68,7 @@
68
68
  "webpackbar": "^7.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29644678.e6ccdeb8",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29644680.78bc1fc6",
72
72
  "@rspack/core": "2.0.2",
73
73
  "@types/webpack-bundle-analyzer": "4.7.0",
74
74
  "@types/webpack-hot-middleware": "2.25.12",
@@ -79,7 +79,7 @@
79
79
  "vue": "3.5.34"
80
80
  },
81
81
  "peerDependencies": {
82
- "nuxt": "npm:nuxt-nightly@5.0.0-29644678.e6ccdeb8",
82
+ "nuxt": "npm:nuxt-nightly@5.0.0-29644680.78bc1fc6",
83
83
  "vue": "^3.3.4"
84
84
  },
85
85
  "engines": {