@nx/webpack 19.5.3 → 19.5.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "19.5.3",
3
+ "version": "19.5.5",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
6
6
  "repository": {
@@ -69,9 +69,9 @@
69
69
  "webpack-dev-server": "^4.9.3",
70
70
  "webpack-node-externals": "^3.0.0",
71
71
  "webpack-subresource-integrity": "^5.1.0",
72
- "@nx/devkit": "19.5.3",
73
- "@nx/js": "19.5.3",
74
- "@nrwl/webpack": "19.5.3"
72
+ "@nx/devkit": "19.5.5",
73
+ "@nx/js": "19.5.5",
74
+ "@nrwl/webpack": "19.5.5"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"
@@ -271,6 +271,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
271
271
  }
272
272
  config.output = {
273
273
  ...config.output,
274
+ assetModuleFilename: '[name].[contenthash:20][ext]',
274
275
  crossOriginLoading: options.subresourceIntegrity
275
276
  ? 'anonymous'
276
277
  : false,
@@ -338,9 +339,6 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
338
339
  maxSize: 10_000, // 10 kB
339
340
  },
340
341
  },
341
- generator: {
342
- filename: `[name]${hashFormat.file}[ext]`,
343
- },
344
342
  },
345
343
  // SVG: same as image but we need to separate it so it can be swapped for SVGR in the React plugin.
346
344
  {
@@ -351,17 +349,11 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
351
349
  maxSize: 10_000, // 10 kB
352
350
  },
353
351
  },
354
- generator: {
355
- filename: `[name]${hashFormat.file}[ext]`,
356
- },
357
352
  },
358
353
  // Fonts: Emit separate file and export the URL.
359
354
  {
360
355
  test: /\.(eot|otf|ttf|woff|woff2)$/,
361
356
  type: 'asset/resource',
362
- generator: {
363
- filename: `[name]${hashFormat.file}[ext]`,
364
- },
365
357
  },
366
358
  ...rules,
367
359
  ],
@@ -62,5 +62,6 @@ function ensureNxWebpackExecutionContext(ctx) {
62
62
  cwd: process.cwd(),
63
63
  root: devkit_1.workspaceRoot,
64
64
  isVerbose: process.env['NX_VERBOSE_LOGGING'] === 'true',
65
+ projectGraph,
65
66
  };
66
67
  }
@@ -52,7 +52,12 @@ function shareWorkspaceLibraries(workspaceLibs, tsConfigPath = process.env.NX_TS
52
52
  }
53
53
  const webpack = require('webpack');
54
54
  return {
55
- getAliases: () => pathMappings.reduce((aliases, library) => ({ ...aliases, [library.name]: library.path }), {}),
55
+ getAliases: () => pathMappings.reduce((aliases, library) => ({
56
+ ...aliases,
57
+ // If the library path ends in a wildcard, remove it as webpack can't handle this in resolve.alias
58
+ // e.g. path/to/my/lib/* -> path/to/my/lib
59
+ [library.name]: library.path.replace(/\/\*$/, ''),
60
+ }), {}),
56
61
  getLibraries: (projectRoot, eager) => {
57
62
  let pkgJson = null;
58
63
  if (projectRoot &&
@@ -97,7 +102,17 @@ function shareWorkspaceLibraries(workspaceLibs, tsConfigPath = process.env.NX_TS
97
102
  for (const library of pathMappings) {
98
103
  const libFolder = (0, path_1.normalize)((0, path_1.dirname)(library.path));
99
104
  if (!from.startsWith(libFolder) && to.startsWith(libFolder)) {
100
- req.request = library.name;
105
+ const newReq = library.name.endsWith('/*')
106
+ ? /**
107
+ * req usually is in the form of "../../../path/to/file"
108
+ * library.path is usually in the form of "/Users/username/path/to/Workspace/path/to/library"
109
+ *
110
+ * When a wildcard is used in the TS path mappings, we want to get everything after the import to
111
+ * re-route the request correctly inline with the webpack resolve.alias
112
+ */
113
+ (0, path_1.join)(library.name, req.request.split(library.path.replace(devkit_1.workspaceRoot, '').replace('/*', ''))[1])
114
+ : library.name;
115
+ req.request = newReq;
101
116
  }
102
117
  }
103
118
  }),