@nx/rspack 20.3.0-beta.0 → 20.3.0-beta.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.
- package/package.json +5 -5
- package/src/executors/rspack/lib/normalize-options.js +2 -0
- package/src/executors/rspack/schema.d.ts +1 -0
- package/src/plugins/utils/apply-base-config.js +7 -2
- package/src/plugins/utils/apply-react-config.js +3 -3
- package/src/plugins/utils/models.d.ts +4 -0
- package/src/utils/config.js +1 -0
- package/src/utils/read-rspack-options.js +1 -0
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.3.0-beta.
|
|
4
|
+
"version": "20.3.0-beta.1",
|
|
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.3.0-beta.
|
|
28
|
-
"@nx/devkit": "20.3.0-beta.
|
|
29
|
-
"@nx/web": "20.3.0-beta.
|
|
30
|
-
"@nx/module-federation": "20.3.0-beta.
|
|
27
|
+
"@nx/js": "20.3.0-beta.1",
|
|
28
|
+
"@nx/devkit": "20.3.0-beta.1",
|
|
29
|
+
"@nx/web": "20.3.0-beta.1",
|
|
30
|
+
"@nx/module-federation": "20.3.0-beta.1",
|
|
31
31
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
32
32
|
"@rspack/core": "^1.1.5",
|
|
33
33
|
"@rspack/dev-server": "^1.0.9",
|
|
@@ -4,9 +4,11 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
exports.normalizePluginPath = normalizePluginPath;
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const normalize_options_1 = require("../../../plugins/utils/plugins/normalize-options");
|
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
8
|
function normalizeOptions(options, root, projectRoot, sourceRoot) {
|
|
8
9
|
const normalizedOptions = {
|
|
9
10
|
...options,
|
|
11
|
+
useTsconfigPaths: !(0, ts_solution_setup_1.isUsingTsSolutionSetup)(),
|
|
10
12
|
root,
|
|
11
13
|
projectRoot,
|
|
12
14
|
sourceRoot,
|
|
@@ -164,6 +164,7 @@ function applyNxIndependentConfig(options, config) {
|
|
|
164
164
|
function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
165
165
|
const tsConfig = options.tsConfig ?? (0, js_1.getRootTsConfigPath)();
|
|
166
166
|
const plugins = [];
|
|
167
|
+
const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
|
|
167
168
|
const executorContext = {
|
|
168
169
|
projectName: options.projectName,
|
|
169
170
|
targetName: options.targetName,
|
|
@@ -171,9 +172,13 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
171
172
|
configurationName: options.configurationName,
|
|
172
173
|
root: options.root,
|
|
173
174
|
};
|
|
174
|
-
|
|
175
|
+
options.useTsconfigPaths ??= !isUsingTsSolution;
|
|
176
|
+
// If the project is using ts solutions setup, the paths are not in tsconfig and we should not use the plugin's paths.
|
|
177
|
+
if (options.useTsconfigPaths) {
|
|
178
|
+
plugins.push(new nx_tsconfig_paths_rspack_plugin_1.NxTsconfigPathsRspackPlugin({ ...options, tsConfig }));
|
|
179
|
+
}
|
|
175
180
|
// New TS Solution already has a typecheck target
|
|
176
|
-
if (!options?.skipTypeChecking && !
|
|
181
|
+
if (!options?.skipTypeChecking && !isUsingTsSolution) {
|
|
177
182
|
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
178
183
|
plugins.push(new ForkTsCheckerWebpackPlugin({
|
|
179
184
|
typescript: {
|
|
@@ -16,11 +16,11 @@ function applyReactConfig(options, config = {}) {
|
|
|
16
16
|
config.module.rules.push({
|
|
17
17
|
test: /\.svg$/i,
|
|
18
18
|
type: 'asset',
|
|
19
|
-
resourceQuery: /
|
|
19
|
+
resourceQuery: /url/, // *.svg?url
|
|
20
20
|
}, {
|
|
21
21
|
test: /\.svg$/i,
|
|
22
22
|
issuer: /\.[jt]sx?$/,
|
|
23
|
-
resourceQuery: { not: [/
|
|
23
|
+
resourceQuery: { not: [/url/] }, // exclude react component if not *.svg?url
|
|
24
24
|
use: [{ loader: '@svgr/webpack', options: svgrOptions }],
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -31,7 +31,7 @@ function applyReactConfig(options, config = {}) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function removeSvgLoaderIfPresent(config) {
|
|
34
|
-
const svgLoaderIdx = config.module.rules.findIndex((rule) => typeof rule === 'object' && rule.test
|
|
34
|
+
const svgLoaderIdx = config.module.rules.findIndex((rule) => typeof rule === 'object' && rule.test?.toString().includes('svg'));
|
|
35
35
|
if (svgLoaderIdx === -1)
|
|
36
36
|
return;
|
|
37
37
|
config.module.rules.splice(svgLoaderIdx, 1);
|
|
@@ -196,6 +196,10 @@ export interface NxAppRspackPluginOptions {
|
|
|
196
196
|
* List of TypeScript Compiler Transformers Plugins.
|
|
197
197
|
*/
|
|
198
198
|
transformers?: TransformerEntry[];
|
|
199
|
+
/**
|
|
200
|
+
* Use tsconfig-paths-webpack-plugin to resolve modules using paths in the tsconfig file.
|
|
201
|
+
*/
|
|
202
|
+
useTsconfigPaths?: boolean;
|
|
199
203
|
/**
|
|
200
204
|
* Generate a separate vendor chunk for 3rd party packages.
|
|
201
205
|
*/
|
package/src/utils/config.js
CHANGED