@nx/rspack 20.6.2 → 20.6.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/rspack",
|
|
3
3
|
"description": "The Nx Plugin for Rspack contains executors and generators that support building applications using Rspack.",
|
|
4
|
-
"version": "20.6.
|
|
4
|
+
"version": "20.6.4",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"generators": "./generators.json",
|
|
25
25
|
"executors": "./executors.json",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nx/js": "20.6.
|
|
28
|
-
"@nx/devkit": "20.6.
|
|
29
|
-
"@nx/web": "20.6.
|
|
30
|
-
"@nx/module-federation": "20.6.
|
|
27
|
+
"@nx/js": "20.6.4",
|
|
28
|
+
"@nx/devkit": "20.6.4",
|
|
29
|
+
"@nx/web": "20.6.4",
|
|
30
|
+
"@nx/module-federation": "20.6.4",
|
|
31
31
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
32
32
|
"@rspack/core": "^1.1.5",
|
|
33
33
|
"@rspack/dev-server": "^1.0.9",
|
|
@@ -27,6 +27,12 @@ class NxAppRspackPlugin {
|
|
|
27
27
|
if (typeof target === 'string') {
|
|
28
28
|
this.options.target = target;
|
|
29
29
|
}
|
|
30
|
+
if (compiler.options.entry &&
|
|
31
|
+
compiler.options.entry['main'] &&
|
|
32
|
+
typeof compiler.options.entry['main'] === 'object' &&
|
|
33
|
+
Object.keys(compiler.options.entry['main']).length === 0) {
|
|
34
|
+
compiler.options.entry = {};
|
|
35
|
+
}
|
|
30
36
|
(0, apply_base_config_1.applyBaseConfig)(this.options, compiler.options, {
|
|
31
37
|
useNormalizedEntry: true,
|
|
32
38
|
});
|
package/src/plugins/plugin.js
CHANGED
|
@@ -101,6 +101,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
101
101
|
...(existingValue ? JSON.parse(existingValue) : {}),
|
|
102
102
|
module: 'CommonJS',
|
|
103
103
|
moduleResolution: 'Node10',
|
|
104
|
+
customConditions: null,
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
targets[options.buildTargetName] = {
|
|
@@ -42,7 +42,7 @@ function applyNxIndependentConfig(options, config) {
|
|
|
42
42
|
config.node = false;
|
|
43
43
|
config.mode =
|
|
44
44
|
// When the target is Node avoid any optimizations, such as replacing `process.env.NODE_ENV` with build time value.
|
|
45
|
-
config.target === 'node'
|
|
45
|
+
config.target === 'node' || config.target === 'async-node'
|
|
46
46
|
? 'none'
|
|
47
47
|
: // Otherwise, make sure it matches `process.env.NODE_ENV`.
|
|
48
48
|
// When mode is development or production, rspack will automatically
|
|
@@ -59,13 +59,20 @@ function applyNxIndependentConfig(options, config) {
|
|
|
59
59
|
: 'none');
|
|
60
60
|
// When target is Node, the Webpack mode will be set to 'none' which disables in memory caching and causes a full rebuild on every change.
|
|
61
61
|
// So to mitigate this we enable in memory caching when target is Node and in watch mode.
|
|
62
|
-
config.cache =
|
|
62
|
+
config.cache =
|
|
63
|
+
(options.target === 'node' || options.target === 'async-node') &&
|
|
64
|
+
options.watch
|
|
65
|
+
? true
|
|
66
|
+
: undefined;
|
|
63
67
|
config.devtool =
|
|
64
68
|
options.sourceMap === true ? 'source-map' : options.sourceMap;
|
|
65
69
|
config.output = {
|
|
66
70
|
...(config.output ?? {}),
|
|
67
|
-
libraryTarget:
|
|
68
|
-
|
|
71
|
+
libraryTarget: options.target === 'node'
|
|
72
|
+
? 'commonjs'
|
|
73
|
+
: options.target === 'async-node'
|
|
74
|
+
? 'commonjs-module'
|
|
75
|
+
: undefined,
|
|
69
76
|
path: config.output?.path ??
|
|
70
77
|
(options.outputPath
|
|
71
78
|
? // If path is relative, it is relative from project root (aka cwd).
|
|
@@ -263,7 +270,8 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
263
270
|
plugins.push(new stats_json_plugin_1.StatsJsonPlugin());
|
|
264
271
|
}
|
|
265
272
|
const externals = [];
|
|
266
|
-
if (options.target === 'node'
|
|
273
|
+
if ((options.target === 'node' || options.target === 'async-node') &&
|
|
274
|
+
options.externalDependencies === 'all') {
|
|
267
275
|
const modulesDir = `${options.root}/node_modules`;
|
|
268
276
|
externals.push(nodeExternals({ modulesDir }));
|
|
269
277
|
}
|