@nx/webpack 23.1.0-rc.3 → 23.2.0-beta.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.
@@ -150,6 +150,10 @@ function applyNxIndependentConfig(options, config) {
150
150
  })
151
151
  : new TerserPlugin({
152
152
  minify: TerserPlugin.swcMinify,
153
+ // terser-webpack-plugin 5.6+ forwards `extractComments` into swc's
154
+ // minify options, which rejects it as an unknown field. Disable it
155
+ // like the babel branch does above.
156
+ extractComments: false,
153
157
  // `terserOptions` options will be passed to `swc`
154
158
  terserOptions: {
155
159
  module: true,
@@ -16,12 +16,24 @@ function resolveConditionalExport(target) {
16
16
  if (typeof target === 'string') {
17
17
  return target;
18
18
  }
19
+ // Fallback arrays: take the first non-empty target. Node resolves them in
20
+ // order on disk; for the allowlist any valid target marks the subpath.
21
+ if (Array.isArray(target)) {
22
+ for (const candidate of target) {
23
+ const resolved = resolveConditionalExport(candidate);
24
+ if (resolved) {
25
+ return resolved;
26
+ }
27
+ }
28
+ return null;
29
+ }
19
30
  if (typeof target === 'object' && target !== null) {
20
31
  // Priority order for conditions
21
32
  const conditions = ['development', 'import', 'require', 'default'];
22
33
  for (const condition of conditions) {
23
- if (target[condition] && typeof target[condition] === 'string') {
24
- return target[condition];
34
+ const resolved = resolveConditionalExport(target[condition]);
35
+ if (resolved) {
36
+ return resolved;
25
37
  }
26
38
  }
27
39
  }
@@ -4,7 +4,6 @@ exports.PostcssCliResources = PostcssCliResources;
4
4
  const tslib_1 = require("tslib");
5
5
  const loader_utils_1 = require("loader-utils");
6
6
  const path = tslib_1.__importStar(require("path"));
7
- const url_1 = require("url");
8
7
  function wrapUrl(url) {
9
8
  let wrappedUrl;
10
9
  const hasSingleQuotes = url.indexOf("'") >= 0;
@@ -80,14 +79,19 @@ function PostcssCliResources(options) {
80
79
  // Separate URL query/hash from the file path before resolving
81
80
  const [, filePath, urlSuffix] = inputUrl.match(/^([^?#]*)(.*)$/);
82
81
  const resolvedPath = path.resolve(context, filePath.replace(/\\/g, '/'));
83
- const { pathname } = (0, url_1.pathToFileURL)(resolvedPath);
82
+ // Resolve a relative filesystem path, not a file:// URL pathname: on Windows the
83
+ // pathname is `/C:/...` (spaces as %20), which the resolver cannot find. Relative
84
+ // (not absolute) lets `resolve()`'s `./`-prefixed lookup succeed on the first try.
85
+ const resolveRequest = path
86
+ .relative(context, resolvedPath)
87
+ .replace(/\\/g, '/');
84
88
  let hash = '';
85
89
  let search = '';
86
90
  if (urlSuffix) {
87
91
  ({ hash, search } = new URL(`file:///dummy${urlSuffix}`));
88
92
  }
89
93
  const resolver = (file, base) => new Promise((resolve, reject) => {
90
- loader.resolve(base, decodeURI(file), (err, result) => {
94
+ loader.resolve(base, file, (err, result) => {
91
95
  if (err) {
92
96
  reject(err);
93
97
  return;
@@ -95,7 +99,7 @@ function PostcssCliResources(options) {
95
99
  resolve(result);
96
100
  });
97
101
  });
98
- const result = await resolve(pathname, context, resolver);
102
+ const result = await resolve(resolveRequest, context, resolver);
99
103
  return new Promise((resolve, reject) => {
100
104
  loader.fs.readFile(result, (err, content) => {
101
105
  if (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "23.1.0-rc.3",
3
+ "version": "23.2.0-beta.0",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -118,8 +118,8 @@
118
118
  "tslib": "^2.3.0",
119
119
  "webpack-node-externals": "^3.0.0",
120
120
  "webpack-subresource-integrity": "^5.1.0",
121
- "@nx/devkit": "23.1.0-rc.3",
122
- "@nx/js": "23.1.0-rc.3"
121
+ "@nx/devkit": "23.2.0-beta.0",
122
+ "@nx/js": "23.2.0-beta.0"
123
123
  },
124
124
  "peerDependencies": {
125
125
  "webpack": "^5.0.0",
@@ -138,7 +138,7 @@
138
138
  }
139
139
  },
140
140
  "devDependencies": {
141
- "nx": "23.1.0-rc.3"
141
+ "nx": "23.2.0-beta.0"
142
142
  },
143
143
  "publishConfig": {
144
144
  "access": "public"