@nuxt/webpack-builder 3.7.4 → 3.8.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 (3) hide show
  1. package/README.md +2 -2
  2. package/dist/index.mjs +39 -35
  3. package/package.json +23 -22
package/README.md CHANGED
@@ -17,7 +17,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
17
17
  - Automatic routing with code-splitting
18
18
  - State management
19
19
  - SEO Optimization
20
- - Extandable with [100+ modules](https://nuxt.com/modules)
20
+ - Extensible with [100+ modules](https://nuxt.com/modules)
21
21
  - Deployment to a variety of hosting platforms
22
22
  - ...[and much more](https://nuxt.com) 🚀
23
23
 
@@ -50,7 +50,7 @@ Here are a few ways you can get involved:
50
50
 
51
51
  ## Local Development
52
52
 
53
- Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#set-up-your-local-development-environment) to contribute to the framework and documentation.
53
+ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#setup) to contribute to the framework and documentation.
54
54
 
55
55
  ## Nuxt 2
56
56
 
package/dist/index.mjs CHANGED
@@ -19,7 +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 { cloneDeep, defaults as defaults$1, merge, uniq } from 'lodash-es';
22
+ import { cloneDeep } from 'lodash-es';
23
23
  import TimeFixPlugin from 'time-fix-plugin';
24
24
  import WebpackBar from 'webpackbar';
25
25
  import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin';
@@ -27,6 +27,7 @@ import { isTest } from 'std-env';
27
27
  import { EsbuildPlugin } from 'esbuild-loader';
28
28
  import MiniCssExtractPlugin from 'mini-css-extract-plugin';
29
29
  import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
30
+ import createResolver from 'postcss-import-resolver';
30
31
  import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js';
31
32
  import { normalizeWebpackManifest } from 'vue-bundle-renderer';
32
33
  import hash$1 from 'hash-sum';
@@ -48,7 +49,7 @@ var __publicField$3 = (obj, key, value) => {
48
49
  return value;
49
50
  };
50
51
  const stringTypes = ["Literal", "TemplateLiteral"];
51
- const NUXT_LIB_RE = /node_modules\/nuxt3?\//;
52
+ const NUXT_LIB_RE = /node_modules\/(nuxt|nuxt3|nuxt-nightly)\//;
52
53
  const SUPPORTED_EXT_RE = /\.(m?[jt]sx?|vue)/;
53
54
  const composableKeysPlugin = createUnplugin((options) => {
54
55
  const composableMeta = Object.fromEntries(options.composables.map(({ name, ...meta }) => [name, meta]));
@@ -703,14 +704,6 @@ const orderPresets = {
703
704
  }
704
705
  };
705
706
  const getPostcssConfig = (nuxt) => {
706
- function defaultConfig() {
707
- return {
708
- sourceMap: nuxt.options.webpack.cssSourceMap,
709
- plugins: nuxt.options.postcss.plugins,
710
- // Array, String or Function
711
- order: "autoprefixerAndCssnanoLast"
712
- };
713
- }
714
707
  function sortPlugins({ plugins, order }) {
715
708
  const names = Object.keys(plugins);
716
709
  if (typeof order === "string") {
@@ -718,37 +711,45 @@ const getPostcssConfig = (nuxt) => {
718
711
  }
719
712
  return typeof order === "function" ? order(names, orderPresets) : order || names;
720
713
  }
721
- function loadPlugins(config) {
722
- if (!isPureObject(config.plugins)) {
723
- return;
724
- }
714
+ if (!nuxt.options.webpack.postcss || !nuxt.options.postcss) {
715
+ return false;
716
+ }
717
+ const postcssOptions = defu({}, nuxt.options.postcss, {
718
+ plugins: {
719
+ /**
720
+ * https://github.com/postcss/postcss-import
721
+ */
722
+ "postcss-import": {
723
+ resolve: createResolver({
724
+ alias: { ...nuxt.options.alias },
725
+ modules: nuxt.options.modulesDir
726
+ })
727
+ },
728
+ /**
729
+ * https://github.com/postcss/postcss-url
730
+ */
731
+ "postcss-url": {}
732
+ },
733
+ sourceMap: nuxt.options.webpack.cssSourceMap,
734
+ // Array, String or Function
735
+ order: "autoprefixerAndCssnanoLast"
736
+ });
737
+ if (!Array.isArray(postcssOptions.plugins) && isPureObject(postcssOptions.plugins)) {
725
738
  const cjs = createCommonJS(import.meta.url);
726
- config.plugins = sortPlugins(config).map((pluginName) => {
739
+ postcssOptions.plugins = sortPlugins(postcssOptions).map((pluginName) => {
727
740
  const pluginFn = requireModule(pluginName, { paths: [cjs.__dirname] });
728
- const pluginOptions = config.plugins[pluginName];
741
+ const pluginOptions = postcssOptions.plugins[pluginName];
729
742
  if (!pluginOptions || typeof pluginFn !== "function") {
730
743
  return null;
731
744
  }
732
745
  return pluginFn(pluginOptions);
733
746
  }).filter(Boolean);
734
747
  }
735
- if (!nuxt.options.webpack.postcss || !nuxt.options.postcss) {
736
- return false;
737
- }
738
- let postcssOptions = cloneDeep(nuxt.options.postcss);
739
- if (isPureObject(postcssOptions)) {
740
- if (Array.isArray(postcssOptions.plugins)) {
741
- defaults$1(postcssOptions, defaultConfig());
742
- } else {
743
- postcssOptions = merge({}, defaultConfig(), postcssOptions);
744
- loadPlugins(postcssOptions);
745
- }
746
- return {
747
- sourceMap: nuxt.options.webpack.cssSourceMap,
748
- ...nuxt.options.webpack.postcss,
749
- postcssOptions
750
- };
751
- }
748
+ return {
749
+ sourceMap: nuxt.options.webpack.cssSourceMap,
750
+ ...nuxt.options.webpack.postcss,
751
+ postcssOptions
752
+ };
752
753
  };
753
754
 
754
755
  function style(ctx) {
@@ -870,6 +871,9 @@ var __publicField$1 = (obj, key, value) => {
870
871
  __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
871
872
  return value;
872
873
  };
874
+ function uniq(items) {
875
+ return [...new Set(items)];
876
+ }
873
877
  class VueSSRClientPlugin {
874
878
  constructor(options) {
875
879
  __publicField$1(this, "options");
@@ -1120,7 +1124,7 @@ function clientHMR(ctx) {
1120
1124
  function clientOptimization(_ctx) {
1121
1125
  }
1122
1126
  function clientPlugins(ctx) {
1123
- if (!ctx.isDev && ctx.name === "client" && ctx.userConfig.analyze) {
1127
+ if (!ctx.isDev && ctx.name === "client" && ctx.userConfig.analyze && (ctx.userConfig.analyze === true || ctx.userConfig.analyze.enabled)) {
1124
1128
  const statsDir = resolve(ctx.options.analyzeDir);
1125
1129
  ctx.config.plugins.push(new BundleAnalyzerPlugin({
1126
1130
  analyzerMode: "static",
@@ -1183,7 +1187,6 @@ function server(ctx) {
1183
1187
  serverPreset,
1184
1188
  serverPlugins
1185
1189
  ]);
1186
- return getWebpackConfig(ctx);
1187
1190
  }
1188
1191
  function serverPreset(ctx) {
1189
1192
  ctx.config.output.filename = "server.mjs";
@@ -1204,6 +1207,7 @@ function serverStandalone(ctx) {
1204
1207
  "#app",
1205
1208
  "nuxt",
1206
1209
  "nuxt3",
1210
+ "nuxt-nightly",
1207
1211
  "!",
1208
1212
  "-!",
1209
1213
  "~",
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder",
3
- "version": "3.7.4",
3
+ "version": "3.8.1",
4
4
  "repository": "nuxt/nuxt",
5
+ "description": "Webpack bundler for Nuxt",
5
6
  "license": "MIT",
6
7
  "type": "module",
7
8
  "types": "./dist/index.d.ts",
@@ -21,54 +22,54 @@
21
22
  "css-loader": "^6.8.1",
22
23
  "css-minimizer-webpack-plugin": "^5.0.1",
23
24
  "cssnano": "^6.0.1",
24
- "defu": "^6.1.2",
25
+ "defu": "^6.1.3",
25
26
  "esbuild-loader": "^4.0.2",
26
27
  "escape-string-regexp": "^5.0.0",
27
28
  "estree-walker": "^3.0.3",
28
29
  "file-loader": "^6.2.0",
29
- "fork-ts-checker-webpack-plugin": "^8.0.0",
30
+ "fork-ts-checker-webpack-plugin": "^9.0.2",
30
31
  "fs-extra": "^11.1.1",
31
- "h3": "^1.8.1",
32
+ "h3": "^1.8.2",
32
33
  "hash-sum": "^2.0.0",
33
- "lodash-es": "^4.17.21",
34
- "magic-string": "^0.30.3",
35
- "memfs": "^4.5.0",
34
+ "lodash-es": "4.17.21",
35
+ "magic-string": "^0.30.5",
36
+ "memfs": "^4.6.0",
36
37
  "mini-css-extract-plugin": "^2.7.6",
37
38
  "mlly": "^1.4.2",
38
39
  "ohash": "^1.1.3",
39
40
  "pathe": "^1.1.1",
40
41
  "pify": "^6.1.0",
41
- "postcss": "^8.4.30",
42
+ "postcss": "^8.4.31",
42
43
  "postcss-import": "^15.1.0",
44
+ "postcss-import-resolver": "^2.0.0",
43
45
  "postcss-loader": "^7.3.3",
44
46
  "postcss-url": "^10.1.3",
45
47
  "pug-plain-loader": "^1.1.0",
46
48
  "std-env": "^3.4.3",
47
49
  "time-fix-plugin": "^2.0.7",
48
- "ufo": "^1.3.0",
50
+ "ufo": "^1.3.1",
49
51
  "unplugin": "^1.5.0",
50
52
  "url-loader": "^4.1.1",
51
53
  "vue-bundle-renderer": "^2.0.0",
52
- "vue-loader": "^17.2.2",
53
- "webpack": "^5.88.2",
54
+ "vue-loader": "^17.3.1",
55
+ "webpack": "^5.89.0",
54
56
  "webpack-bundle-analyzer": "^4.9.1",
55
57
  "webpack-dev-middleware": "^6.1.1",
56
58
  "webpack-hot-middleware": "^2.25.4",
57
- "webpack-virtual-modules": "^0.5.0",
59
+ "webpack-virtual-modules": "^0.6.0",
58
60
  "webpackbar": "^5.0.2",
59
- "@nuxt/kit": "3.7.4"
61
+ "@nuxt/kit": "3.8.1"
60
62
  },
61
63
  "devDependencies": {
62
- "@types/fs-extra": "11.0.2",
63
- "@types/hash-sum": "1.0.0",
64
- "@types/lodash-es": "4.17.9",
65
- "@types/pify": "5.0.2",
66
- "@types/webpack-bundle-analyzer": "4.6.1",
67
- "@types/webpack-hot-middleware": "2.25.7",
68
- "@types/webpack-virtual-modules": "0.1.2",
64
+ "@types/fs-extra": "11.0.3",
65
+ "@types/hash-sum": "1.0.1",
66
+ "@types/pify": "5.0.3",
67
+ "@types/webpack-bundle-analyzer": "4.6.2",
68
+ "@types/webpack-hot-middleware": "2.25.8",
69
+ "@types/webpack-virtual-modules": "0.1.3",
69
70
  "unbuild": "latest",
70
- "vue": "3.3.4",
71
- "@nuxt/schema": "3.7.4"
71
+ "vue": "3.3.8",
72
+ "@nuxt/schema": "3.8.1"
72
73
  },
73
74
  "peerDependencies": {
74
75
  "vue": "^3.3.4"