@nuxt/webpack-builder 3.0.0-rc.3 → 3.0.0-rc.4
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/dist/index.mjs +26 -11
- package/package.json +17 -18
package/dist/index.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import webpackHotMiddleware from 'webpack-hot-middleware';
|
|
|
5
5
|
import { joinURL } from 'ufo';
|
|
6
6
|
import { useNuxt, logger, requireModule } from '@nuxt/kit';
|
|
7
7
|
import { createUnplugin } from 'unplugin';
|
|
8
|
-
import 'escape-string-regexp';
|
|
8
|
+
import escapeRE from 'escape-string-regexp';
|
|
9
9
|
import MagicString from 'magic-string';
|
|
10
|
-
import { join, resolve, dirname, isAbsolute } from 'pathe';
|
|
10
|
+
import { join, resolve, normalize, dirname, isAbsolute } from 'pathe';
|
|
11
11
|
import { createFsFromVolume, Volume } from 'memfs';
|
|
12
12
|
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
13
13
|
import querystring from 'node:querystring';
|
|
@@ -60,7 +60,7 @@ const DynamicBasePlugin = createUnplugin(function(options = {}) {
|
|
|
60
60
|
s.replace(/const base = ['"]\/__NUXT_BASE__\/['"]/, "const base = buildAssetsURL()");
|
|
61
61
|
}
|
|
62
62
|
s.replace(/from *['"]\/__NUXT_BASE__(\/[^'"]*)['"]/g, 'from "$1"');
|
|
63
|
-
const delimiterRE = /(?<!(const base = |from *))(`([^`]*)\/__NUXT_BASE__\/([^`]*)`|'([^\n']*)\/__NUXT_BASE__\/([^\n']*)'|"([^\n"]*)\/__NUXT_BASE__\/([^\n"]*)")/g;
|
|
63
|
+
const delimiterRE = /(?<!(const base = |from *))((?<!\\)`([^`]*)\/__NUXT_BASE__\/([^`]*)(?<!\\)`|(?<!\\)'([^\n']*)\/__NUXT_BASE__\/([^\n']*)(?<!\\)'|(?<!\\)"([^\n"]*)\/__NUXT_BASE__\/([^\n"]*)(?<!\\)")/g;
|
|
64
64
|
s.replace(delimiterRE, (r) => "`" + r.replace(/\/__NUXT_BASE__\//g, "${__publicAssetsURL()}").slice(1, -1) + "`");
|
|
65
65
|
if (s.hasChanged()) {
|
|
66
66
|
return {
|
|
@@ -204,7 +204,8 @@ function base(ctx) {
|
|
|
204
204
|
baseAlias,
|
|
205
205
|
baseConfig,
|
|
206
206
|
basePlugins,
|
|
207
|
-
baseResolve
|
|
207
|
+
baseResolve,
|
|
208
|
+
baseTranspile
|
|
208
209
|
]);
|
|
209
210
|
}
|
|
210
211
|
function baseConfig(ctx) {
|
|
@@ -304,6 +305,24 @@ function baseResolve(ctx) {
|
|
|
304
305
|
...config.resolveLoader
|
|
305
306
|
};
|
|
306
307
|
}
|
|
308
|
+
function baseTranspile(ctx) {
|
|
309
|
+
const { options } = ctx;
|
|
310
|
+
const transpile = [
|
|
311
|
+
/\.vue\.js/i,
|
|
312
|
+
/consola\/src/
|
|
313
|
+
];
|
|
314
|
+
for (let pattern of options.build.transpile) {
|
|
315
|
+
if (typeof pattern === "function") {
|
|
316
|
+
pattern = pattern(ctx);
|
|
317
|
+
}
|
|
318
|
+
if (typeof pattern === "string") {
|
|
319
|
+
transpile.push(new RegExp(escapeRE(normalize(pattern))));
|
|
320
|
+
} else if (pattern instanceof RegExp) {
|
|
321
|
+
transpile.push(pattern);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
ctx.transpile = [...transpile, ...ctx.transpile];
|
|
325
|
+
}
|
|
307
326
|
function getCache(ctx) {
|
|
308
327
|
const { options } = ctx;
|
|
309
328
|
if (!options.dev) {
|
|
@@ -458,7 +477,7 @@ const getPostcssConfig = (nuxt) => {
|
|
|
458
477
|
if (!nuxt.options.webpack.postcss || !nuxt.options.postcss) {
|
|
459
478
|
return false;
|
|
460
479
|
}
|
|
461
|
-
const configFile = nuxt.options.postcss
|
|
480
|
+
const configFile = nuxt.options.postcss.config;
|
|
462
481
|
if (configFile) {
|
|
463
482
|
return {
|
|
464
483
|
postcssOptions: {
|
|
@@ -505,7 +524,7 @@ function extractCSS(ctx) {
|
|
|
505
524
|
config.plugins.push(new MiniCssExtractPlugin({
|
|
506
525
|
filename: fileName(ctx, "css"),
|
|
507
526
|
chunkFilename: fileName(ctx, "css"),
|
|
508
|
-
...options.webpack.extractCSS
|
|
527
|
+
...options.webpack.extractCSS === true ? {} : options.webpack.extractCSS
|
|
509
528
|
}));
|
|
510
529
|
}
|
|
511
530
|
}
|
|
@@ -562,10 +581,6 @@ function createCssLoadersRule(ctx, cssLoaderOptions) {
|
|
|
562
581
|
];
|
|
563
582
|
}
|
|
564
583
|
return [
|
|
565
|
-
{
|
|
566
|
-
loader: "vue-style-loader",
|
|
567
|
-
options: options.webpack.loaders.vueStyle
|
|
568
|
-
},
|
|
569
584
|
cssLoader
|
|
570
585
|
];
|
|
571
586
|
}
|
|
@@ -942,7 +957,7 @@ function serverPlugins(ctx) {
|
|
|
942
957
|
}
|
|
943
958
|
|
|
944
959
|
async function bundle(nuxt) {
|
|
945
|
-
|
|
960
|
+
registerVirtualModules();
|
|
946
961
|
const webpackConfigs = [client, ...nuxt.options.ssr ? [server] : []].map((preset) => {
|
|
947
962
|
const ctx = createWebpackConfigContext(nuxt);
|
|
948
963
|
applyPresets(ctx, preset);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/webpack-builder",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.4",
|
|
4
4
|
"repository": "nuxt/framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,56 +16,55 @@
|
|
|
16
16
|
"prepack": "unbuild"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@babel/core": "^7.
|
|
19
|
+
"@babel/core": "^7.18.5",
|
|
20
20
|
"@nuxt/friendly-errors-webpack-plugin": "^2.5.2",
|
|
21
|
-
"@nuxt/kit": "^3.0.0-rc.
|
|
21
|
+
"@nuxt/kit": "^3.0.0-rc.4",
|
|
22
22
|
"autoprefixer": "^10.4.7",
|
|
23
23
|
"css-loader": "^6.7.1",
|
|
24
|
-
"css-minimizer-webpack-plugin": "^
|
|
25
|
-
"cssnano": "^5.1.
|
|
26
|
-
"esbuild-loader": "^2.
|
|
24
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
25
|
+
"cssnano": "^5.1.11",
|
|
26
|
+
"esbuild-loader": "^2.19.0",
|
|
27
27
|
"escape-string-regexp": "^5.0.0",
|
|
28
28
|
"file-loader": "^6.2.0",
|
|
29
29
|
"fork-ts-checker-webpack-plugin": "^7.2.11",
|
|
30
30
|
"fs-extra": "^10.1.0",
|
|
31
31
|
"hash-sum": "^2.0.0",
|
|
32
32
|
"lodash-es": "^4.17.21",
|
|
33
|
-
"magic-string": "^0.26.
|
|
34
|
-
"memfs": "^3.4.
|
|
33
|
+
"magic-string": "^0.26.2",
|
|
34
|
+
"memfs": "^3.4.4",
|
|
35
35
|
"mini-css-extract-plugin": "^2.6.0",
|
|
36
36
|
"mlly": "^0.5.2",
|
|
37
37
|
"pathe": "^0.3.0",
|
|
38
|
-
"pify": "^
|
|
39
|
-
"postcss": "^8.4.
|
|
38
|
+
"pify": "^6.0.0",
|
|
39
|
+
"postcss": "^8.4.14",
|
|
40
40
|
"postcss-import": "^14.1.0",
|
|
41
|
-
"postcss-loader": "^
|
|
41
|
+
"postcss-loader": "^7.0.0",
|
|
42
42
|
"postcss-url": "^10.1.3",
|
|
43
43
|
"style-resources-loader": "^1.5.0",
|
|
44
44
|
"time-fix-plugin": "^2.0.7",
|
|
45
45
|
"ufo": "^0.8.4",
|
|
46
|
-
"unplugin": "^0.
|
|
46
|
+
"unplugin": "^0.7.0",
|
|
47
47
|
"url-loader": "^4.1.1",
|
|
48
48
|
"vue-loader": "^17.0.0",
|
|
49
|
-
"
|
|
50
|
-
"webpack": "^5.72.0",
|
|
49
|
+
"webpack": "^5.73.0",
|
|
51
50
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
52
|
-
"webpack-dev-middleware": "^5.3.
|
|
51
|
+
"webpack-dev-middleware": "^5.3.3",
|
|
53
52
|
"webpack-hot-middleware": "^2.25.1",
|
|
54
53
|
"webpack-virtual-modules": "^0.4.3",
|
|
55
54
|
"webpackbar": "^5.0.2"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@nuxt/schema": "^3.0.0-rc.
|
|
57
|
+
"@nuxt/schema": "^3.0.0-rc.4",
|
|
59
58
|
"@types/pify": "^5.0.1",
|
|
60
59
|
"@types/webpack-bundle-analyzer": "^4.4.1",
|
|
61
60
|
"@types/webpack-dev-middleware": "^5.0.2",
|
|
62
61
|
"@types/webpack-hot-middleware": "^2.25.6",
|
|
63
62
|
"@types/webpack-virtual-modules": "^0",
|
|
64
63
|
"unbuild": "latest",
|
|
65
|
-
"vue": "3.2.
|
|
64
|
+
"vue": "3.2.37"
|
|
66
65
|
},
|
|
67
66
|
"peerDependencies": {
|
|
68
|
-
"vue": "3.2.
|
|
67
|
+
"vue": "^3.2.37"
|
|
69
68
|
},
|
|
70
69
|
"engines": {
|
|
71
70
|
"node": "^14.16.0 || ^16.11.0 || ^17.0.0 || ^18.0.0"
|