@nx/rspack 20.0.1 → 20.0.3
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/README.md +0 -49
- package/package.json +12 -6
- package/src/executors/dev-server/dev-server.impl.js +1 -2
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +2 -2
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +2 -2
- package/src/utils/resolve-user-defined-rspack-config.js +1 -1
- package/src/utils/with-web.js +2 -2
package/README.md
CHANGED
|
@@ -66,52 +66,3 @@ npx nx@latest init
|
|
|
66
66
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
67
67
|
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
|
|
71
|
-
|
|
72
|
-
<hr>
|
|
73
|
-
|
|
74
|
-
# Nx: Smart, Fast and Extensible Build System
|
|
75
|
-
|
|
76
|
-
Nx is a next generation build system with first class monorepo support and powerful integrations.
|
|
77
|
-
|
|
78
|
-
This package is a Rspack plugin for Nx.
|
|
79
|
-
|
|
80
|
-
## Getting Started
|
|
81
|
-
|
|
82
|
-
Use `--preset=@nx/rspack` when creating new workspace.
|
|
83
|
-
|
|
84
|
-
e.g.
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npx create-nx-workspace@latest rspack-demo --preset=@nx/rspack
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Now, you can go into the `rspack-demo` folder and start development.
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
cd rspack-demo
|
|
94
|
-
npm start
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
You can also run lint, test, and e2e scripts for the project.
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
npm run lint
|
|
101
|
-
npm run test
|
|
102
|
-
npm run e2e
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Existing workspaces
|
|
106
|
-
|
|
107
|
-
You can add Rspack to any existing Nx workspace.
|
|
108
|
-
|
|
109
|
-
First, install the plugin:
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
npm install --save-dev @nx/rspack
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Then, r
|
|
116
|
-
|
|
117
|
-
**Note:** You must restart the server if you make any changes to your library.
|
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.0.
|
|
4
|
+
"version": "20.0.3",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,19 +24,25 @@
|
|
|
24
24
|
"generators": "./generators.json",
|
|
25
25
|
"executors": "./executors.json",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nx/js": "20.0.
|
|
28
|
-
"@nx/devkit": "20.0.
|
|
29
|
-
"@nx/
|
|
27
|
+
"@nx/js": "20.0.3",
|
|
28
|
+
"@nx/devkit": "20.0.3",
|
|
29
|
+
"@nx/web": "20.0.3",
|
|
30
30
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
31
|
+
"enquirer": "~2.3.6",
|
|
32
|
+
"express": "^4.19.2",
|
|
33
|
+
"http-proxy-middleware": "^3.0.0",
|
|
31
34
|
"less-loader": "11.1.0",
|
|
32
35
|
"license-webpack-plugin": "^4.0.2",
|
|
33
36
|
"sass-loader": "^12.2.0",
|
|
34
37
|
"stylus-loader": "^7.1.0",
|
|
35
38
|
"postcss-loader": "^8.1.1",
|
|
36
39
|
"@rspack/core": "^1.0.4",
|
|
40
|
+
"@rspack/dev-server": "^1.0.4",
|
|
37
41
|
"@rspack/plugin-react-refresh": "^1.0.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
42
|
+
"chalk": "~4.1.0",
|
|
43
|
+
"tsconfig-paths": "^4.1.2",
|
|
44
|
+
"tslib": "^2.3.0",
|
|
45
|
+
"webpack-sources": "^3.2.3"
|
|
40
46
|
},
|
|
41
47
|
"peerDependencies": {
|
|
42
48
|
"@module-federation/enhanced": "~0.6.0",
|
|
@@ -24,9 +24,8 @@ async function* runExecutor(options, context) {
|
|
|
24
24
|
devServerConfig = {
|
|
25
25
|
...devServerConfig,
|
|
26
26
|
...firstCompiler.options.devServer,
|
|
27
|
-
port: devServerConfig.port,
|
|
28
27
|
};
|
|
29
|
-
const baseUrl = `http://localhost:${
|
|
28
|
+
const baseUrl = `http://localhost:${devServerConfig.port ?? 4200}`;
|
|
30
29
|
return yield* (0, async_iterable_1.createAsyncIterable)(({ next }) => {
|
|
31
30
|
const server = new dev_server_1.RspackDevServer({
|
|
32
31
|
...devServerConfig,
|
|
@@ -131,8 +131,8 @@ async function* moduleFederationDevServer(options, context) {
|
|
|
131
131
|
options.staticRemotesPort ??= remotes.staticRemotePort;
|
|
132
132
|
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
133
133
|
process.env.NX_MF_DEV_REMOTES = JSON.stringify([
|
|
134
|
-
...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []),
|
|
135
|
-
p.name,
|
|
134
|
+
...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []).map((r) => r.replace(/-/g, '_')),
|
|
135
|
+
p.name.replace(/-/g, '_'),
|
|
136
136
|
]);
|
|
137
137
|
const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
|
|
138
138
|
const mappedLocationsOfStaticRemotes = await (0, build_static_remotes_1.buildStaticRemotes)(staticRemotesConfig, nxBin, context, options);
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -168,8 +168,8 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
|
168
168
|
}, pathToManifestFile);
|
|
169
169
|
options.staticRemotesPort ??= remotes.staticRemotePort;
|
|
170
170
|
process.env.NX_MF_DEV_REMOTES = JSON.stringify([
|
|
171
|
-
...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []),
|
|
172
|
-
projectConfig.name,
|
|
171
|
+
...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []).map((r) => r.replace(/-/g, '_')),
|
|
172
|
+
projectConfig.name.replace(/-/g, '_'),
|
|
173
173
|
]);
|
|
174
174
|
const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticSsrRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
|
|
175
175
|
const mappedLocationsOfStaticRemotes = await buildSsrStaticRemotes(staticRemotesConfig, nxBin, context, options);
|
|
@@ -23,7 +23,7 @@ reload = false) {
|
|
|
23
23
|
const maybeCustomRspackConfig = require(path);
|
|
24
24
|
cleanupTranspiler();
|
|
25
25
|
// If the user provides a configuration in TS file
|
|
26
|
-
// then there are 3 cases for
|
|
26
|
+
// then there are 3 cases for exploring an object. The first one is:
|
|
27
27
|
// `module.exports = { ... }`. And the second one is:
|
|
28
28
|
// `export default { ... }`. The ESM format is compiled into:
|
|
29
29
|
// `{ default: { ... } }`
|
package/src/utils/with-web.js
CHANGED
|
@@ -97,8 +97,8 @@ function withWeb(opts = {}) {
|
|
|
97
97
|
? path.join(context.root, options.indexHtml)
|
|
98
98
|
: path.join(projectRoot, 'src/index.html'),
|
|
99
99
|
}),
|
|
100
|
-
new core_1.rspack.
|
|
101
|
-
|
|
100
|
+
new core_1.rspack.EnvironmentPlugin({
|
|
101
|
+
NODE_ENV: 'development',
|
|
102
102
|
}),
|
|
103
103
|
],
|
|
104
104
|
};
|