@nuxt/webpack-builder 3.13.2 → 3.14.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/builder.mjs +3 -0
- package/dist/index.mjs +99 -107
- package/package.json +19 -14
package/builder.mjs
ADDED
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import pify from 'pify';
|
|
2
|
-
import webpack from 'webpack';
|
|
3
2
|
import { fromNodeMiddleware, defineEventHandler } from 'h3';
|
|
4
3
|
import webpackDevMiddleware from 'webpack-dev-middleware';
|
|
5
4
|
import webpackHotMiddleware from 'webpack-hot-middleware';
|
|
6
5
|
import { defu } from 'defu';
|
|
7
6
|
import { parseURL, parseQuery, joinURL } from 'ufo';
|
|
8
|
-
import {
|
|
9
|
-
import { pathToFileURL
|
|
7
|
+
import { logger, useNuxt } from '@nuxt/kit';
|
|
8
|
+
import { pathToFileURL } from 'node:url';
|
|
10
9
|
import { createUnplugin } from 'unplugin';
|
|
11
10
|
import { isAbsolute, relative, join, resolve, normalize, dirname } from 'pathe';
|
|
12
11
|
import { walk } from 'estree-walker';
|
|
13
12
|
import MagicString from 'magic-string';
|
|
14
13
|
import { hash } from 'ohash';
|
|
15
14
|
import escapeRE from 'escape-string-regexp';
|
|
16
|
-
import { findStaticImports, parseStaticImport
|
|
15
|
+
import { findStaticImports, parseStaticImport } from 'mlly';
|
|
16
|
+
import { webpack, builder, MiniCssExtractPlugin } from '#builder';
|
|
17
17
|
import { createFsFromVolume, Volume } from 'memfs';
|
|
18
|
-
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
19
18
|
import querystring from 'node:querystring';
|
|
20
19
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
21
20
|
import ForkTSCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
@@ -26,13 +25,12 @@ import WebpackBar from 'webpackbar';
|
|
|
26
25
|
import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin';
|
|
27
26
|
import { isTest } from 'std-env';
|
|
28
27
|
import { EsbuildPlugin } from 'esbuild-loader';
|
|
29
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
30
28
|
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
31
29
|
import createResolver from 'postcss-import-resolver';
|
|
30
|
+
import { createJiti } from 'jiti';
|
|
32
31
|
import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js';
|
|
33
32
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
34
33
|
import { normalizeWebpackManifest } from 'vue-bundle-renderer';
|
|
35
|
-
import hash$1 from 'hash-sum';
|
|
36
34
|
|
|
37
35
|
function matchWithStringOrRegex(value, matcher) {
|
|
38
36
|
if (typeof matcher === "string") {
|
|
@@ -43,15 +41,16 @@ function matchWithStringOrRegex(value, matcher) {
|
|
|
43
41
|
return false;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
var __defProp$
|
|
47
|
-
var __defNormalProp$
|
|
48
|
-
var __publicField$
|
|
49
|
-
__defNormalProp$
|
|
44
|
+
var __defProp$4 = Object.defineProperty;
|
|
45
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
46
|
+
var __publicField$4 = (obj, key, value) => {
|
|
47
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
50
48
|
return value;
|
|
51
49
|
};
|
|
52
50
|
const stringTypes = ["Literal", "TemplateLiteral"];
|
|
53
51
|
const NUXT_LIB_RE = /node_modules\/(?:nuxt|nuxt3|nuxt-nightly)\//;
|
|
54
52
|
const SUPPORTED_EXT_RE = /\.(?:m?[jt]sx?|vue)/;
|
|
53
|
+
const SCRIPT_RE = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/i;
|
|
55
54
|
const composableKeysPlugin = createUnplugin((options) => {
|
|
56
55
|
const composableMeta = {};
|
|
57
56
|
const composableLengths = /* @__PURE__ */ new Set();
|
|
@@ -74,7 +73,7 @@ const composableKeysPlugin = createUnplugin((options) => {
|
|
|
74
73
|
if (!KEYED_FUNCTIONS_RE.test(code)) {
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
const { 0: script = code, index: codeIndex = 0 } = code.match(
|
|
76
|
+
const { 0: script = code, index: codeIndex = 0 } = code.match(SCRIPT_RE) || { index: 0, 0: code };
|
|
78
77
|
const s = new MagicString(code);
|
|
79
78
|
let imports;
|
|
80
79
|
let count = 0;
|
|
@@ -179,8 +178,8 @@ const composableKeysPlugin = createUnplugin((options) => {
|
|
|
179
178
|
class ScopeTracker {
|
|
180
179
|
constructor() {
|
|
181
180
|
// the top of the stack is not a part of current key, it is used for next level
|
|
182
|
-
__publicField$
|
|
183
|
-
__publicField$
|
|
181
|
+
__publicField$4(this, "scopeIndexStack");
|
|
182
|
+
__publicField$4(this, "curScopeKey");
|
|
184
183
|
this.scopeIndexStack = [0];
|
|
185
184
|
this.curScopeKey = "";
|
|
186
185
|
}
|
|
@@ -199,8 +198,8 @@ class ScopeTracker {
|
|
|
199
198
|
}
|
|
200
199
|
class ScopedVarsCollector {
|
|
201
200
|
constructor() {
|
|
202
|
-
__publicField$
|
|
203
|
-
__publicField$
|
|
201
|
+
__publicField$4(this, "curScopeKey");
|
|
202
|
+
__publicField$4(this, "all");
|
|
204
203
|
this.all = /* @__PURE__ */ new Map();
|
|
205
204
|
this.curScopeKey = "";
|
|
206
205
|
}
|
|
@@ -299,8 +298,16 @@ ${options.globalPublicPath} = buildAssetsURL();
|
|
|
299
298
|
};
|
|
300
299
|
});
|
|
301
300
|
|
|
301
|
+
var __defProp$3 = Object.defineProperty;
|
|
302
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
303
|
+
var __publicField$3 = (obj, key, value) => {
|
|
304
|
+
__defNormalProp$3(obj, key + "" , value);
|
|
305
|
+
return value;
|
|
306
|
+
};
|
|
302
307
|
const pluginName = "ChunkErrorPlugin";
|
|
303
|
-
|
|
308
|
+
class ChunkErrorPlugin {
|
|
309
|
+
constructor() {
|
|
310
|
+
__publicField$3(this, "script", `
|
|
304
311
|
if (typeof ${webpack.RuntimeGlobals.require} !== "undefined") {
|
|
305
312
|
var _ensureChunk = ${webpack.RuntimeGlobals.ensureChunk};
|
|
306
313
|
${webpack.RuntimeGlobals.ensureChunk} = function (chunkId) {
|
|
@@ -311,14 +318,14 @@ if (typeof ${webpack.RuntimeGlobals.require} !== "undefined") {
|
|
|
311
318
|
throw error
|
|
312
319
|
});
|
|
313
320
|
};
|
|
314
|
-
}
|
|
315
|
-
|
|
321
|
+
};`);
|
|
322
|
+
}
|
|
316
323
|
apply(compiler) {
|
|
317
324
|
compiler.hooks.thisCompilation.tap(
|
|
318
325
|
pluginName,
|
|
319
326
|
(compilation) => compilation.mainTemplate.hooks.localVars.tap(
|
|
320
327
|
{ name: pluginName, stage: 1 },
|
|
321
|
-
(source) => source + script
|
|
328
|
+
(source) => source + this.script
|
|
322
329
|
)
|
|
323
330
|
);
|
|
324
331
|
}
|
|
@@ -333,25 +340,6 @@ function createMFS() {
|
|
|
333
340
|
return _fs;
|
|
334
341
|
}
|
|
335
342
|
|
|
336
|
-
function registerVirtualModules() {
|
|
337
|
-
const nuxt = useNuxt();
|
|
338
|
-
const virtualModules = new VirtualModulesPlugin(nuxt.vfs);
|
|
339
|
-
const writeFiles = () => {
|
|
340
|
-
for (const filePath in nuxt.vfs) {
|
|
341
|
-
virtualModules.writeModule(filePath, nuxt.vfs[filePath] || "");
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
nuxt.hook("webpack:compile", ({ compiler }) => {
|
|
345
|
-
if (compiler.name === "server") {
|
|
346
|
-
writeFiles();
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
nuxt.hook("app:templatesGenerated", writeFiles);
|
|
350
|
-
nuxt.hook("webpack:config", (configs) => configs.forEach((config) => {
|
|
351
|
-
config.plugins.push(virtualModules);
|
|
352
|
-
}));
|
|
353
|
-
}
|
|
354
|
-
|
|
355
343
|
function toArray(value) {
|
|
356
344
|
return Array.isArray(value) ? value : [value];
|
|
357
345
|
}
|
|
@@ -482,10 +470,14 @@ function baseConfig(ctx) {
|
|
|
482
470
|
function basePlugins(ctx) {
|
|
483
471
|
ctx.config.plugins = ctx.config.plugins || [];
|
|
484
472
|
if (ctx.options.dev) {
|
|
485
|
-
ctx.
|
|
473
|
+
if (ctx.nuxt.options.builder !== "@nuxt/rspack-builder") {
|
|
474
|
+
ctx.config.plugins.push(new TimeFixPlugin());
|
|
475
|
+
}
|
|
486
476
|
}
|
|
487
477
|
ctx.config.plugins.push(...ctx.userConfig.plugins || []);
|
|
488
|
-
ctx.
|
|
478
|
+
if (ctx.nuxt.options.builder !== "@nuxt/rspack-builder") {
|
|
479
|
+
ctx.config.plugins.push(new WarningIgnorePlugin(getWarningIgnoreFilter(ctx)));
|
|
480
|
+
}
|
|
489
481
|
ctx.config.plugins.push(new webpack.DefinePlugin(getEnv(ctx)));
|
|
490
482
|
if (ctx.isServer || ctx.isDev && ctx.userConfig.friendlyErrors) {
|
|
491
483
|
ctx.config.plugins.push(
|
|
@@ -513,21 +505,21 @@ function basePlugins(ctx) {
|
|
|
513
505
|
reporter: {
|
|
514
506
|
change: (_, { shortPath }) => {
|
|
515
507
|
if (!ctx.isServer) {
|
|
516
|
-
ctx.nuxt.callHook(
|
|
508
|
+
ctx.nuxt.callHook(`${builder}:change`, shortPath);
|
|
517
509
|
}
|
|
518
510
|
},
|
|
519
511
|
done: ({ state }) => {
|
|
520
512
|
if (state.hasErrors) {
|
|
521
|
-
ctx.nuxt.callHook(
|
|
513
|
+
ctx.nuxt.callHook(`${builder}:error`);
|
|
522
514
|
} else {
|
|
523
515
|
logger.success(`${state.name} ${state.message}`);
|
|
524
516
|
}
|
|
525
517
|
},
|
|
526
518
|
allDone: () => {
|
|
527
|
-
ctx.nuxt.callHook(
|
|
519
|
+
ctx.nuxt.callHook(`${builder}:done`);
|
|
528
520
|
},
|
|
529
521
|
progress({ statesArray }) {
|
|
530
|
-
ctx.nuxt.callHook(
|
|
522
|
+
ctx.nuxt.callHook(`${builder}:progress`, statesArray);
|
|
531
523
|
}
|
|
532
524
|
}
|
|
533
525
|
}
|
|
@@ -537,9 +529,6 @@ function basePlugins(ctx) {
|
|
|
537
529
|
function baseAlias(ctx) {
|
|
538
530
|
ctx.alias = {
|
|
539
531
|
"#app": ctx.options.appDir,
|
|
540
|
-
"#build/plugins": resolve(ctx.options.buildDir, "plugins", ctx.isClient ? "client" : "server"),
|
|
541
|
-
"#build": ctx.options.buildDir,
|
|
542
|
-
"#internal/nuxt/paths": resolve(ctx.nuxt.options.buildDir, "paths.mjs"),
|
|
543
532
|
...ctx.options.alias,
|
|
544
533
|
...ctx.alias
|
|
545
534
|
};
|
|
@@ -567,7 +556,7 @@ function baseTranspile(ctx) {
|
|
|
567
556
|
// include SFCs in node_modules
|
|
568
557
|
/consola\/src/,
|
|
569
558
|
/vue-demi/,
|
|
570
|
-
/(^|\/)nuxt\/(dist\/)?(app|[^/]+\/runtime)($|\/)/
|
|
559
|
+
/(^|\/)nuxt\/(src\/|dist\/)?(app|[^/]+\/runtime)($|\/)/
|
|
571
560
|
];
|
|
572
561
|
for (let pattern of ctx.options.build.transpile) {
|
|
573
562
|
if (typeof pattern === "function") {
|
|
@@ -720,30 +709,24 @@ async function getPostcssConfig(nuxt) {
|
|
|
720
709
|
},
|
|
721
710
|
sourceMap: nuxt.options.webpack.cssSourceMap
|
|
722
711
|
});
|
|
712
|
+
const jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias });
|
|
723
713
|
if (!Array.isArray(postcssOptions.plugins) && isPureObject(postcssOptions.plugins)) {
|
|
724
|
-
const cwd = fileURLToPath(new URL(".", import.meta.url));
|
|
725
714
|
const plugins = [];
|
|
726
715
|
for (const pluginName of sortPlugins(postcssOptions)) {
|
|
727
716
|
const pluginOptions = postcssOptions.plugins[pluginName];
|
|
728
717
|
if (!pluginOptions) {
|
|
729
718
|
continue;
|
|
730
719
|
}
|
|
731
|
-
let pluginPath = resolveAlias(pluginName, nuxt.options.alias);
|
|
732
720
|
let pluginFn;
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
pluginFn = await import(pathToFileURL(path).href).then(interopDefault);
|
|
739
|
-
} else {
|
|
740
|
-
if (!isAbsolute(pluginPath)) {
|
|
741
|
-
console.warn(`[nuxt] could not import postcss plugin \`${pluginName}\` with ESM. Please report this as a bug.`);
|
|
721
|
+
for (const parentURL of nuxt.options.modulesDir) {
|
|
722
|
+
pluginFn = await jiti.import(pluginName, { parentURL: parentURL.replace(/\/node_modules\/?$/, ""), try: true, default: true });
|
|
723
|
+
if (typeof pluginFn === "function") {
|
|
724
|
+
plugins.push(pluginFn(pluginOptions));
|
|
725
|
+
break;
|
|
742
726
|
}
|
|
743
|
-
pluginFn = requireModule(pluginPath, { paths: [cwd] });
|
|
744
727
|
}
|
|
745
|
-
if (typeof pluginFn
|
|
746
|
-
|
|
728
|
+
if (typeof pluginFn !== "function") {
|
|
729
|
+
console.warn(`[nuxt] could not import postcss plugin \`${pluginName}\`. Please report this as a bug.`);
|
|
747
730
|
}
|
|
748
731
|
}
|
|
749
732
|
postcssOptions.plugins = plugins;
|
|
@@ -868,7 +851,8 @@ const validate = (compiler) => {
|
|
|
868
851
|
const isJSRegExp = /\.[cm]?js(\?[^.]+)?$/;
|
|
869
852
|
const isJS = (file) => isJSRegExp.test(file);
|
|
870
853
|
const extractQueryPartJS = (file) => isJSRegExp.exec(file)?.[1];
|
|
871
|
-
const
|
|
854
|
+
const isCSSRegExp = /\.css(?:\?[^.]+)?$/;
|
|
855
|
+
const isCSS = (file) => isCSSRegExp.test(file);
|
|
872
856
|
const isHotUpdate = (file) => file.includes("hot-update");
|
|
873
857
|
|
|
874
858
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -888,9 +872,11 @@ class VueSSRClientPlugin {
|
|
|
888
872
|
compiler.hooks.afterEmit.tap("VueSSRClientPlugin", async (compilation) => {
|
|
889
873
|
const stats = compilation.getStats().toJson();
|
|
890
874
|
const initialFiles = /* @__PURE__ */ new Set();
|
|
891
|
-
for (const
|
|
892
|
-
|
|
893
|
-
|
|
875
|
+
for (const { assets } of Object.values(stats.entrypoints)) {
|
|
876
|
+
if (!assets) {
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
for (const asset of assets) {
|
|
894
880
|
const file = asset.name;
|
|
895
881
|
if ((isJS(file) || isCSS(file)) && !isHotUpdate(file)) {
|
|
896
882
|
initialFiles.add(file);
|
|
@@ -910,7 +896,7 @@ class VueSSRClientPlugin {
|
|
|
910
896
|
asyncFiles.add(file);
|
|
911
897
|
}
|
|
912
898
|
if (isFileJS) {
|
|
913
|
-
const componentHash = hash
|
|
899
|
+
const componentHash = hash(chunkNames.join("|"));
|
|
914
900
|
const map = assetsMapping[componentHash] || (assetsMapping[componentHash] = []);
|
|
915
901
|
map.push(file);
|
|
916
902
|
}
|
|
@@ -926,44 +912,46 @@ class VueSSRClientPlugin {
|
|
|
926
912
|
assetsMapping
|
|
927
913
|
};
|
|
928
914
|
const { entrypoints = {}, namedChunkGroups = {} } = stats;
|
|
929
|
-
const
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
915
|
+
const fileToIndex = (file) => webpackManifest.all.indexOf(String(file));
|
|
916
|
+
for (const m of stats.modules) {
|
|
917
|
+
if (m.chunks?.length !== 1) {
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
const [cid] = m.chunks;
|
|
921
|
+
const chunk = stats.chunks.find((c) => c.id === cid);
|
|
922
|
+
if (!chunk || !chunk.files || !cid) {
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
925
|
+
const id = m.identifier.replace(/\s\w+$/, "");
|
|
926
|
+
const filesSet = new Set(chunk.files.map(fileToIndex).filter((i) => i !== -1));
|
|
927
|
+
for (const chunkName of chunk.names) {
|
|
928
|
+
if (!entrypoints[chunkName]) {
|
|
929
|
+
const chunkGroup = namedChunkGroups[chunkName];
|
|
930
|
+
if (chunkGroup) {
|
|
931
|
+
for (const asset of chunkGroup.assets) {
|
|
932
|
+
filesSet.add(fileToIndex(asset.name));
|
|
947
933
|
}
|
|
948
934
|
}
|
|
949
935
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
936
|
+
}
|
|
937
|
+
const files = Array.from(filesSet);
|
|
938
|
+
webpackManifest.modules[hash(id)] = files;
|
|
939
|
+
if (Array.isArray(m.modules)) {
|
|
940
|
+
for (const concatenatedModule of m.modules) {
|
|
941
|
+
const id2 = hash(concatenatedModule.identifier.replace(/\s\w+$/, ""));
|
|
942
|
+
if (!webpackManifest.modules[id2]) {
|
|
943
|
+
webpackManifest.modules[id2] = files;
|
|
958
944
|
}
|
|
959
945
|
}
|
|
960
|
-
|
|
961
|
-
|
|
946
|
+
}
|
|
947
|
+
if (stats.modules) {
|
|
948
|
+
for (const m2 of stats.modules) {
|
|
949
|
+
if (m2.assets?.length && m2.chunks?.includes(cid)) {
|
|
962
950
|
files.push(...m2.assets.map(fileToIndex));
|
|
963
951
|
}
|
|
964
|
-
}
|
|
952
|
+
}
|
|
965
953
|
}
|
|
966
|
-
}
|
|
954
|
+
}
|
|
967
955
|
const manifest = normalizeWebpackManifest(webpackManifest);
|
|
968
956
|
await this.options.nuxt.callHook("build:manifest", manifest);
|
|
969
957
|
const src = JSON.stringify(manifest, null, 2);
|
|
@@ -1068,8 +1056,9 @@ function vue(ctx) {
|
|
|
1068
1056
|
}));
|
|
1069
1057
|
}
|
|
1070
1058
|
ctx.config.plugins.push(new webpack.DefinePlugin({
|
|
1071
|
-
__VUE_OPTIONS_API__: "true",
|
|
1072
|
-
__VUE_PROD_DEVTOOLS__: "false"
|
|
1059
|
+
"__VUE_OPTIONS_API__": "true",
|
|
1060
|
+
"__VUE_PROD_DEVTOOLS__": "false",
|
|
1061
|
+
"__VUE_PROD_HYDRATION_MISMATCH_DETAILS__": ctx.nuxt.options.debug
|
|
1073
1062
|
}));
|
|
1074
1063
|
}
|
|
1075
1064
|
|
|
@@ -1247,7 +1236,11 @@ function serverStandalone(ctx) {
|
|
|
1247
1236
|
"#",
|
|
1248
1237
|
...ctx.options.build.transpile
|
|
1249
1238
|
];
|
|
1250
|
-
const external = [
|
|
1239
|
+
const external = [
|
|
1240
|
+
"#internal/nitro",
|
|
1241
|
+
"#shared",
|
|
1242
|
+
resolve(ctx.nuxt.options.rootDir, ctx.nuxt.options.dir.shared)
|
|
1243
|
+
];
|
|
1251
1244
|
if (!ctx.nuxt.options.dev) {
|
|
1252
1245
|
external.push("#internal/nuxt/paths");
|
|
1253
1246
|
}
|
|
@@ -1283,20 +1276,19 @@ function serverPlugins(ctx) {
|
|
|
1283
1276
|
}
|
|
1284
1277
|
|
|
1285
1278
|
const bundle = async (nuxt) => {
|
|
1286
|
-
registerVirtualModules();
|
|
1287
1279
|
const webpackConfigs = await Promise.all([client, ...nuxt.options.ssr ? [server] : []].map(async (preset) => {
|
|
1288
1280
|
const ctx = createWebpackConfigContext(nuxt);
|
|
1289
1281
|
ctx.userConfig = defu(nuxt.options.webpack[`$${preset.name}`], ctx.userConfig);
|
|
1290
1282
|
await applyPresets(ctx, preset);
|
|
1291
1283
|
return getWebpackConfig(ctx);
|
|
1292
1284
|
}));
|
|
1293
|
-
await nuxt.callHook(
|
|
1285
|
+
await nuxt.callHook(`${builder}:config`, webpackConfigs);
|
|
1294
1286
|
const mfs = nuxt.options.dev ? createMFS() : null;
|
|
1295
1287
|
for (const config of webpackConfigs) {
|
|
1296
1288
|
config.plugins.push(DynamicBasePlugin.webpack({
|
|
1297
1289
|
sourcemap: !!nuxt.options.sourcemap[config.name]
|
|
1298
1290
|
}));
|
|
1299
|
-
if (config.name === "client" && nuxt.options.experimental.emitRouteChunkError) {
|
|
1291
|
+
if (config.name === "client" && nuxt.options.experimental.emitRouteChunkError && nuxt.options.builder !== "@nuxt/rspack-builder") {
|
|
1300
1292
|
config.plugins.push(new ChunkErrorPlugin());
|
|
1301
1293
|
}
|
|
1302
1294
|
config.plugins.push(composableKeysPlugin.webpack({
|
|
@@ -1305,7 +1297,7 @@ const bundle = async (nuxt) => {
|
|
|
1305
1297
|
composables: nuxt.options.optimization.keyedComposables
|
|
1306
1298
|
}));
|
|
1307
1299
|
}
|
|
1308
|
-
await nuxt.callHook(
|
|
1300
|
+
await nuxt.callHook(`${builder}:configResolved`, webpackConfigs);
|
|
1309
1301
|
const compilers = webpackConfigs.map((config) => {
|
|
1310
1302
|
const compiler = webpack(config);
|
|
1311
1303
|
if (nuxt.options.dev) {
|
|
@@ -1353,9 +1345,9 @@ async function createDevMiddleware(compiler) {
|
|
|
1353
1345
|
}
|
|
1354
1346
|
async function compile(compiler) {
|
|
1355
1347
|
const nuxt = useNuxt();
|
|
1356
|
-
await nuxt.callHook(
|
|
1348
|
+
await nuxt.callHook(`${builder}:compile`, { name: compiler.options.name, compiler });
|
|
1357
1349
|
compiler.hooks.done.tap("load-resources", async (stats2) => {
|
|
1358
|
-
await nuxt.callHook(
|
|
1350
|
+
await nuxt.callHook(`${builder}:compiled`, { name: compiler.options.name, compiler, stats: stats2 });
|
|
1359
1351
|
});
|
|
1360
1352
|
if (nuxt.options.dev) {
|
|
1361
1353
|
const compilersWatching = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/webpack-builder",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
|
+
"imports": {
|
|
15
|
+
"#builder": "./builder.mjs"
|
|
16
|
+
},
|
|
14
17
|
"exports": {
|
|
15
18
|
".": {
|
|
16
19
|
"types": "./dist/index.d.ts",
|
|
@@ -19,7 +22,8 @@
|
|
|
19
22
|
"./dist/*": "./dist/*"
|
|
20
23
|
},
|
|
21
24
|
"files": [
|
|
22
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"builder.mjs"
|
|
23
27
|
],
|
|
24
28
|
"dependencies": {
|
|
25
29
|
"@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
|
|
@@ -33,13 +37,14 @@
|
|
|
33
37
|
"estree-walker": "^3.0.3",
|
|
34
38
|
"file-loader": "^6.2.0",
|
|
35
39
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
|
36
|
-
"h3": "^1.
|
|
40
|
+
"h3": "^1.13.0",
|
|
37
41
|
"hash-sum": "^2.0.0",
|
|
42
|
+
"jiti": "^2.4.0",
|
|
38
43
|
"lodash-es": "4.17.21",
|
|
39
|
-
"magic-string": "^0.30.
|
|
40
|
-
"memfs": "^4.
|
|
41
|
-
"mini-css-extract-plugin": "^2.9.
|
|
42
|
-
"mlly": "^1.7.
|
|
44
|
+
"magic-string": "^0.30.12",
|
|
45
|
+
"memfs": "^4.14.0",
|
|
46
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
47
|
+
"mlly": "^1.7.2",
|
|
43
48
|
"ohash": "^1.1.4",
|
|
44
49
|
"pathe": "^1.1.2",
|
|
45
50
|
"pify": "^6.1.0",
|
|
@@ -53,27 +58,27 @@
|
|
|
53
58
|
"time-fix-plugin": "^2.0.7",
|
|
54
59
|
"ufo": "^1.5.4",
|
|
55
60
|
"unenv": "^1.10.0",
|
|
56
|
-
"unplugin": "^1.
|
|
61
|
+
"unplugin": "^1.15.0",
|
|
57
62
|
"url-loader": "^4.1.1",
|
|
58
|
-
"vue-bundle-renderer": "^2.1.
|
|
63
|
+
"vue-bundle-renderer": "^2.1.1",
|
|
59
64
|
"vue-loader": "^17.4.2",
|
|
60
|
-
"webpack": "^5.
|
|
65
|
+
"webpack": "^5.96.1",
|
|
61
66
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
62
67
|
"webpack-dev-middleware": "^7.4.2",
|
|
63
68
|
"webpack-hot-middleware": "^2.26.1",
|
|
64
|
-
"webpack-virtual-modules": "^0.6.2",
|
|
65
69
|
"webpackbar": "^6.0.1",
|
|
66
|
-
"@nuxt/kit": "3.
|
|
70
|
+
"@nuxt/kit": "3.14.0"
|
|
67
71
|
},
|
|
68
72
|
"devDependencies": {
|
|
73
|
+
"@rspack/core": "1.0.14",
|
|
69
74
|
"@types/hash-sum": "1.0.2",
|
|
70
75
|
"@types/lodash-es": "4.17.12",
|
|
71
76
|
"@types/pify": "5.0.4",
|
|
72
77
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
73
78
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
74
79
|
"unbuild": "latest",
|
|
75
|
-
"vue": "3.5.
|
|
76
|
-
"@nuxt/schema": "3.
|
|
80
|
+
"vue": "3.5.12",
|
|
81
|
+
"@nuxt/schema": "3.14.0"
|
|
77
82
|
},
|
|
78
83
|
"peerDependencies": {
|
|
79
84
|
"vue": "^3.3.4"
|