@nx/rspack 20.5.0-rc.4 → 20.6.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.
- package/package.json +5 -5
- package/src/plugins/plugin.js +26 -2
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.
|
|
4
|
+
"version": "20.6.0-beta.0",
|
|
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.
|
|
28
|
-
"@nx/devkit": "20.
|
|
29
|
-
"@nx/web": "20.
|
|
30
|
-
"@nx/module-federation": "20.
|
|
27
|
+
"@nx/js": "20.6.0-beta.0",
|
|
28
|
+
"@nx/devkit": "20.6.0-beta.0",
|
|
29
|
+
"@nx/web": "20.6.0-beta.0",
|
|
30
|
+
"@nx/module-federation": "20.6.0-beta.0",
|
|
31
31
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
32
32
|
"@rspack/core": "^1.1.5",
|
|
33
33
|
"@rspack/dev-server": "^1.0.9",
|
package/src/plugins/plugin.js
CHANGED
|
@@ -14,7 +14,14 @@ const resolve_user_defined_rspack_config_1 = require("../utils/resolve-user-defi
|
|
|
14
14
|
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
15
15
|
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
16
16
|
function readTargetsCache(cachePath) {
|
|
17
|
-
|
|
17
|
+
try {
|
|
18
|
+
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false'
|
|
19
|
+
? (0, devkit_1.readJsonFile)(cachePath)
|
|
20
|
+
: {};
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
18
25
|
}
|
|
19
26
|
function writeTargetsToCache(cachePath, results) {
|
|
20
27
|
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
@@ -85,9 +92,24 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
const targets = {};
|
|
95
|
+
const env = {};
|
|
96
|
+
const isTsConfig = ['.ts', '.cts', '.mts'].includes((0, path_1.extname)(configFilePath));
|
|
97
|
+
if (isTsConfig) {
|
|
98
|
+
// https://rspack.dev/config/#using-ts-node
|
|
99
|
+
const existingValue = process.env['TS_NODE_COMPILER_OPTIONS'];
|
|
100
|
+
env['TS_NODE_COMPILER_OPTIONS'] = JSON.stringify({
|
|
101
|
+
...(existingValue ? JSON.parse(existingValue) : {}),
|
|
102
|
+
module: 'CommonJS',
|
|
103
|
+
moduleResolution: 'Node10',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
88
106
|
targets[options.buildTargetName] = {
|
|
89
107
|
command: `rspack build`,
|
|
90
|
-
options: {
|
|
108
|
+
options: {
|
|
109
|
+
cwd: projectRoot,
|
|
110
|
+
args: ['--node-env=production'],
|
|
111
|
+
env,
|
|
112
|
+
},
|
|
91
113
|
cache: true,
|
|
92
114
|
dependsOn: [`^${options.buildTargetName}`],
|
|
93
115
|
inputs: 'production' in namedInputs
|
|
@@ -112,6 +134,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
112
134
|
options: {
|
|
113
135
|
cwd: projectRoot,
|
|
114
136
|
args: ['--node-env=development'],
|
|
137
|
+
env,
|
|
115
138
|
},
|
|
116
139
|
};
|
|
117
140
|
targets[options.previewTargetName] = {
|
|
@@ -119,6 +142,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
119
142
|
options: {
|
|
120
143
|
cwd: projectRoot,
|
|
121
144
|
args: ['--node-env=production'],
|
|
145
|
+
env,
|
|
122
146
|
},
|
|
123
147
|
};
|
|
124
148
|
targets[options.serveStaticTargetName] = {
|