@nx/react 24.0.0-pr.37405.acdaf31 → 24.0.0-rc.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/dist/index.d.ts +0 -2
- package/dist/index.js +1 -5
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +3 -1
- package/dist/module-federation.d.ts +6 -5
- package/dist/module-federation.js +29 -18
- package/dist/plugins/component-testing/index.js +92 -33
- package/dist/plugins/storybook/index.js +18 -18
- package/dist/plugins/with-react.d.ts +3 -7
- package/dist/plugins/with-react.js +5 -19
- package/dist/ready-check.d.ts +1 -0
- package/dist/ready-check.js +5 -0
- package/dist/src/generators/_utils/mf-dependencies.js +3 -0
- package/dist/src/generators/application/application.js +1 -36
- package/dist/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +1 -24
- package/dist/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +1 -26
- package/dist/src/generators/application/lib/add-e2e.js +11 -11
- package/dist/src/generators/application/lib/add-linting.js +1 -2
- package/dist/src/generators/application/lib/add-project.js +0 -167
- package/dist/src/generators/application/lib/bundlers/add-rsbuild.js +0 -1
- package/dist/src/generators/application/lib/bundlers/add-vite.js +0 -2
- package/dist/src/generators/application/lib/bundlers/add-webpack.js +0 -1
- package/dist/src/generators/application/lib/create-application-files.d.ts +0 -2
- package/dist/src/generators/application/lib/create-application-files.js +2 -11
- package/dist/src/generators/application/lib/normalize-options.js +0 -4
- package/dist/src/generators/application/schema.d.ts +0 -6
- package/dist/src/generators/application/schema.json +0 -6
- package/dist/src/generators/consumer/consumer.js +2 -0
- package/dist/src/generators/consumer/files/rsbuild/package.json__tmpl__ +1 -0
- package/dist/src/generators/consumer/files/rsbuild/rsbuild.config.ts__tmpl__ +2 -0
- package/dist/src/generators/consumer/files/rspack/package.json__tmpl__ +1 -0
- package/dist/src/generators/consumer/files/rspack/rspack.config.ts__tmpl__ +2 -0
- package/dist/src/generators/consumer/files/vite/package.json__tmpl__ +1 -0
- package/dist/src/generators/consumer/files/vite/vite.config.mts__tmpl__ +2 -0
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +4 -16
- package/dist/src/generators/cypress-component-configuration/lib/add-files.d.ts +1 -2
- package/dist/src/generators/cypress-component-configuration/lib/add-files.js +4 -2
- package/dist/src/generators/cypress-component-configuration/schema.d.ts +0 -1
- package/dist/src/generators/init/init.js +3 -5
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/generators/library/lib/add-linting.js +1 -2
- package/dist/src/generators/library/lib/add-rollup-build-target.js +3 -47
- package/dist/src/generators/library/lib/normalize-options.js +0 -4
- package/dist/src/generators/library/library.js +1 -4
- package/dist/src/generators/library/schema.d.ts +0 -5
- package/dist/src/generators/library/schema.json +0 -6
- package/dist/src/generators/provider/files/rsbuild/package.json__tmpl__ +1 -0
- package/dist/src/generators/provider/files/rsbuild/rsbuild.config.ts__tmpl__ +2 -0
- package/dist/src/generators/provider/files/rspack/package.json__tmpl__ +1 -0
- package/dist/src/generators/provider/files/rspack/rspack.config.ts__tmpl__ +2 -0
- package/dist/src/generators/provider/files/vite/package.json__tmpl__ +1 -0
- package/dist/src/generators/provider/files/vite/vite.config.mts__tmpl__ +2 -0
- package/dist/src/generators/provider/provider.js +2 -0
- package/dist/src/generators/stories/stories.js +0 -5
- package/dist/src/generators/storybook-configuration/configuration.js +1 -9
- package/dist/src/generators/storybook-configuration/schema.d.ts +0 -1
- package/dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.js +2 -1
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.js +13 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.md +40 -0
- package/dist/src/plugins/router-plugin-utils.d.ts +4 -0
- package/dist/src/plugins/router-plugin-utils.js +15 -0
- package/dist/src/plugins/router-plugin.d.ts +0 -1
- package/dist/src/plugins/router-plugin.js +35 -44
- package/dist/src/utils/ast-utils.d.ts +0 -1
- package/dist/src/utils/ast-utils.js +0 -23
- package/dist/src/utils/ct-utils.d.ts +0 -7
- package/dist/src/utils/ct-utils.js +71 -55
- package/dist/src/utils/deprecation.d.ts +1 -1
- package/dist/src/utils/deprecation.js +3 -5
- package/dist/src/utils/framework.js +1 -3
- package/dist/src/utils/react-router-serve-ready-check.d.ts +11 -0
- package/dist/src/utils/react-router-serve-ready-check.js +25 -0
- package/dist/src/utils/versions.d.ts +0 -7
- package/dist/src/utils/versions.js +2 -9
- package/executors.json +1 -17
- package/generators.json +0 -27
- package/migrations.json +6 -0
- package/package.json +25 -39
- package/dist/mf/dynamic-federation.d.ts +0 -69
- package/dist/mf/dynamic-federation.js +0 -141
- package/dist/mf/index.d.ts +0 -1
- package/dist/mf/index.js +0 -8
- package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -4
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -19
- package/dist/src/executors/module-federation-dev-server/lib/start-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/start-remotes.js +0 -33
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -6
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -80
- package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -19
- package/dist/src/executors/module-federation-dev-server/schema.json +0 -142
- package/dist/src/executors/module-federation-ssr-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-ssr-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -4
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -23
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.js +0 -34
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -3
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -83
- package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -29
- package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -81
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +0 -12
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.js +0 -244
- package/dist/src/executors/module-federation-static-server/schema.d.ts +0 -3
- package/dist/src/executors/module-federation-static-server/schema.json +0 -16
- package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
- package/dist/src/generators/federate-module/federate-module.js +0 -67
- package/dist/src/generators/federate-module/lib/utils.d.ts +0 -23
- package/dist/src/generators/federate-module/lib/utils.js +0 -99
- package/dist/src/generators/federate-module/schema.d.ts +0 -15
- package/dist/src/generators/federate-module/schema.json +0 -89
- package/dist/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +0 -40
- package/dist/src/generators/host/files/common/src/main.js__tmpl__ +0 -13
- package/dist/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +0 -41
- package/dist/src/generators/host/files/common-ts/src/main.ts__tmpl__ +0 -13
- package/dist/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +0 -42
- package/dist/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +0 -13
- package/dist/src/generators/host/files/rspack-common/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -24
- package/dist/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -42
- package/dist/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -66
- package/dist/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -27
- package/dist/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -68
- package/dist/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -49
- package/dist/src/generators/host/files/rspack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -22
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -68
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -49
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -67
- package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -42
- package/dist/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -24
- package/dist/src/generators/host/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -39
- package/dist/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -19
- package/dist/src/generators/host/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -16
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -40
- package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -18
- package/dist/src/generators/host/host.d.ts +0 -4
- package/dist/src/generators/host/host.js +0 -174
- package/dist/src/generators/host/lib/add-module-federation-files.d.ts +0 -6
- package/dist/src/generators/host/lib/add-module-federation-files.js +0 -92
- package/dist/src/generators/host/lib/normalize-host-name.d.ts +0 -2
- package/dist/src/generators/host/lib/normalize-host-name.js +0 -12
- package/dist/src/generators/host/lib/setup-ssr-for-host.d.ts +0 -6
- package/dist/src/generators/host/lib/setup-ssr-for-host.js +0 -59
- package/dist/src/generators/host/lib/update-module-federation-e2e-project.d.ts +0 -3
- package/dist/src/generators/host/lib/update-module-federation-e2e-project.js +0 -19
- package/dist/src/generators/host/lib/update-module-federation-tsconfig.d.ts +0 -3
- package/dist/src/generators/host/lib/update-module-federation-tsconfig.js +0 -34
- package/dist/src/generators/host/schema.d.ts +0 -44
- package/dist/src/generators/host/schema.json +0 -173
- package/dist/src/generators/remote/files/common/src/main.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common/src/remote-entry.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common-ts/src/main.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common-ts/src/remote-entry.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-common/src/main.jsx__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-common/src/remote-entry.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -12
- package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -15
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -71
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -19
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -71
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
- package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -12
- package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -9
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -13
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
- package/dist/src/generators/remote/files/webpack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -17
- package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +0 -2
- package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.js +0 -12
- package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.d.ts +0 -3
- package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.js +0 -30
- package/dist/src/generators/remote/lib/setup-ssr-for-remote.d.ts +0 -4
- package/dist/src/generators/remote/lib/setup-ssr-for-remote.js +0 -61
- package/dist/src/generators/remote/lib/setup-tspath-for-remote.d.ts +0 -3
- package/dist/src/generators/remote/lib/setup-tspath-for-remote.js +0 -14
- package/dist/src/generators/remote/lib/update-host-with-remote.d.ts +0 -2
- package/dist/src/generators/remote/lib/update-host-with-remote.js +0 -79
- package/dist/src/generators/remote/remote.d.ts +0 -6
- package/dist/src/generators/remote/remote.js +0 -201
- package/dist/src/generators/remote/schema.d.ts +0 -39
- package/dist/src/generators/remote/schema.json +0 -173
- package/dist/src/generators/setup-ssr/files/server.ts__tmpl__ +0 -28
- package/dist/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +0 -47
- package/dist/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/setup-ssr/schema.d.ts +0 -8
- package/dist/src/generators/setup-ssr/schema.json +0 -54
- package/dist/src/generators/setup-ssr/setup-ssr.d.ts +0 -4
- package/dist/src/generators/setup-ssr/setup-ssr.js +0 -198
- package/dist/src/module-federation/ast-utils.d.ts +0 -8
- package/dist/src/module-federation/ast-utils.js +0 -101
- package/dist/src/rules/update-module-federation-project.d.ts +0 -11
- package/dist/src/rules/update-module-federation-project.js +0 -72
- package/dist/src/utils/add-mf-env-to-inputs.d.ts +0 -2
- package/dist/src/utils/add-mf-env-to-inputs.js +0 -29
- package/dist/src/utils/module-federation-deprecation.d.ts +0 -12
- package/dist/src/utils/module-federation-deprecation.js +0 -46
- package/dist/src/utils/normalize-remote.d.ts +0 -8
- package/dist/src/utils/normalize-remote.js +0 -31
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"cli": "nx",
|
|
4
|
-
"$id": "NxReactFederateModule",
|
|
5
|
-
"title": "Federate Module",
|
|
6
|
-
"description": "Create a federated module, which can be loaded by a Consumer (host) via a Producer (remote).",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"command": "nx g federate-module MyModule --path=./src/component/my-cmp.ts --remote=myRemote --remoteDirectory=apps/myRemote",
|
|
10
|
-
"description": "Create a federated module from myRemote, that exposes my-cmp from ./src/component/my-cmp.ts as MyModule."
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"command": "nx g federate-module MyModule --path=./src/component/my-cmp.ts --producer=myProducer --producerDirectory=apps/myProducer",
|
|
14
|
-
"description": "Create a federated module from myProducer, that exposes my-cmp from ./src/component/my-cmp.ts as MyModule."
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"type": "object",
|
|
18
|
-
"properties": {
|
|
19
|
-
"path": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"$default": {
|
|
22
|
-
"$source": "argv",
|
|
23
|
-
"index": 0
|
|
24
|
-
},
|
|
25
|
-
"description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.",
|
|
26
|
-
"x-prompt": "What is the path to the module to be federated?"
|
|
27
|
-
},
|
|
28
|
-
"name": {
|
|
29
|
-
"description": "The name of the module.",
|
|
30
|
-
"type": "string",
|
|
31
|
-
"x-prompt": "What name would you like to use for the module?",
|
|
32
|
-
"pattern": "^[a-zA-Z][^:]*$",
|
|
33
|
-
"x-priority": "important"
|
|
34
|
-
},
|
|
35
|
-
"remote": {
|
|
36
|
-
"type": "string",
|
|
37
|
-
"description": "The name of the Producer (remote).",
|
|
38
|
-
"x-prompt": "What is/should the Producer (remote) be named?",
|
|
39
|
-
"alias": "producer"
|
|
40
|
-
},
|
|
41
|
-
"remoteDirectory": {
|
|
42
|
-
"description": "The directory of the new Producer (remote) application if one needs to be created.",
|
|
43
|
-
"type": "string",
|
|
44
|
-
"alias": "producerDirectory"
|
|
45
|
-
},
|
|
46
|
-
"style": {
|
|
47
|
-
"description": "The file extension to be used for style files.",
|
|
48
|
-
"type": "string",
|
|
49
|
-
"default": "none",
|
|
50
|
-
"alias": "s"
|
|
51
|
-
},
|
|
52
|
-
"linter": {
|
|
53
|
-
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
54
|
-
"type": "string",
|
|
55
|
-
"enum": ["eslint", "oxlint", "none"]
|
|
56
|
-
},
|
|
57
|
-
"skipFormat": {
|
|
58
|
-
"description": "Skip formatting files.",
|
|
59
|
-
"type": "boolean",
|
|
60
|
-
"default": false,
|
|
61
|
-
"x-priority": "internal"
|
|
62
|
-
},
|
|
63
|
-
"unitTestRunner": {
|
|
64
|
-
"type": "string",
|
|
65
|
-
"enum": ["jest", "vitest", "none"],
|
|
66
|
-
"description": "Test runner to use for unit tests.",
|
|
67
|
-
"default": "jest"
|
|
68
|
-
},
|
|
69
|
-
"e2eTestRunner": {
|
|
70
|
-
"type": "string",
|
|
71
|
-
"enum": ["cypress", "playwright", "none"],
|
|
72
|
-
"description": "Test runner to use for end to end (E2E) tests.",
|
|
73
|
-
"x-prompt": "Which E2E test runner would you like to use?",
|
|
74
|
-
"default": "cypress"
|
|
75
|
-
},
|
|
76
|
-
"host": {
|
|
77
|
-
"type": "string",
|
|
78
|
-
"description": "The Consumer (host) application for this Producer (remote)."
|
|
79
|
-
},
|
|
80
|
-
"bundler": {
|
|
81
|
-
"description": "The bundler to use.",
|
|
82
|
-
"type": "string",
|
|
83
|
-
"enum": ["rspack", "webpack"],
|
|
84
|
-
"default": "rspack"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
"required": ["name", "path", "remote"],
|
|
88
|
-
"additionalProperties": false
|
|
89
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
<%_ if (!minimal) { _%>
|
|
3
|
-
import NxWelcome from "./nx-welcome";
|
|
4
|
-
<%_ } _%>
|
|
5
|
-
import { Link, Route, Routes } from 'react-router-dom';
|
|
6
|
-
<%_ if (dynamic && remotes.length > 0) { _%>
|
|
7
|
-
import { loadRemote } from '@module-federation/enhanced/runtime';
|
|
8
|
-
<%_ } _%>
|
|
9
|
-
|
|
10
|
-
<%_ if (remotes.length > 0) {
|
|
11
|
-
remotes.forEach(function(r) { _%>
|
|
12
|
-
<%_ if (dynamic) { _%>
|
|
13
|
-
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
|
|
14
|
-
<%_ } else { _%>
|
|
15
|
-
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
|
|
16
|
-
<%_ } _%>
|
|
17
|
-
<%_ }); _%>
|
|
18
|
-
<%_ } _%>
|
|
19
|
-
export function App() {
|
|
20
|
-
return (
|
|
21
|
-
<React.Suspense fallback={null}>
|
|
22
|
-
<ul>
|
|
23
|
-
<li><Link to="/">Home</Link></li>
|
|
24
|
-
<%_ remotes.forEach(function(r) { _%>
|
|
25
|
-
<li><Link to="/<%=r.fileName%>"><%=r.className%></Link></li>
|
|
26
|
-
<%_ }); _%>
|
|
27
|
-
</ul>
|
|
28
|
-
<Routes>
|
|
29
|
-
<%_ if (!minimal) { _%>
|
|
30
|
-
<Route path="/" element={<NxWelcome title="<%= projectName %>"/>} />
|
|
31
|
-
<%_ } _%>
|
|
32
|
-
<%_ remotes.forEach(function(r) { _%>
|
|
33
|
-
<Route path="/<%=r.fileName%>" element={<<%= r.className %>/>} />
|
|
34
|
-
<%_ }); _%>
|
|
35
|
-
</Routes>
|
|
36
|
-
</React.Suspense>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default App;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<%_ if (dynamic) { _%>
|
|
2
|
-
import { registerRemotes } from '@module-federation/enhanced/runtime';
|
|
3
|
-
|
|
4
|
-
fetch('/assets/module-federation.manifest.json')
|
|
5
|
-
.then((res) => res.json())
|
|
6
|
-
.then((remotes: Record<string, string>) =>
|
|
7
|
-
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
|
|
8
|
-
)
|
|
9
|
-
.then((remotes) => registerRemotes(remotes))
|
|
10
|
-
.then(() => import('./bootstrap').catch(err => console.error(err)));
|
|
11
|
-
<%_ } else { _%>
|
|
12
|
-
import('./bootstrap').catch(err => console.error(err));
|
|
13
|
-
<%_ } _%>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"types": [
|
|
6
|
-
"node",
|
|
7
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
8
|
-
"@nx/react/typings/image.d.ts"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*.js",
|
|
13
|
-
"src/**/*.jsx",
|
|
14
|
-
"src/**/*.ts",
|
|
15
|
-
"src/**/*.tsx",
|
|
16
|
-
"webpack.config.ts",
|
|
17
|
-
"webpack.prod.config.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
<%_ if (!minimal) { _%>
|
|
3
|
-
import NxWelcome from "./nx-welcome";
|
|
4
|
-
<%_ } _%>
|
|
5
|
-
import { Link, Route, Routes } from 'react-router-dom';
|
|
6
|
-
<%_ if (dynamic && remotes.length > 0) { _%>
|
|
7
|
-
import { loadRemote } from '@module-federation/enhanced/runtime';
|
|
8
|
-
<%_ } _%>
|
|
9
|
-
|
|
10
|
-
<%_ if (remotes.length > 0) {
|
|
11
|
-
remotes.forEach(function(r) { _%>
|
|
12
|
-
<%_ if (dynamic) { _%>
|
|
13
|
-
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
|
|
14
|
-
<%_ } else { _%>
|
|
15
|
-
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
|
|
16
|
-
<%_ } _%>
|
|
17
|
-
<%_ }); _%>
|
|
18
|
-
<%_ } _%>
|
|
19
|
-
|
|
20
|
-
export function App() {
|
|
21
|
-
return (
|
|
22
|
-
<React.Suspense fallback={null}>
|
|
23
|
-
<ul>
|
|
24
|
-
<li><Link to="/">Home</Link></li>
|
|
25
|
-
<%_ remotes.forEach(function(r) { _%>
|
|
26
|
-
<li><Link to="/<%=r.fileName%>"><%=r.className%></Link></li>
|
|
27
|
-
<%_ }); _%>
|
|
28
|
-
</ul>
|
|
29
|
-
<Routes>
|
|
30
|
-
<%_ if (!minimal) { _%>
|
|
31
|
-
<Route path="/" element={<NxWelcome title="<%= projectName %>"/>} />
|
|
32
|
-
<%_ } _%>
|
|
33
|
-
<%_ remotes.forEach(function(r) { _%>
|
|
34
|
-
<Route path="/<%=r.fileName%>" element={<<%= r.className %>/>} />
|
|
35
|
-
<%_ }); _%>
|
|
36
|
-
</Routes>
|
|
37
|
-
</React.Suspense>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default App;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<%_ if (dynamic) { _%>
|
|
2
|
-
import { registerRemotes } from '@module-federation/enhanced/runtime';
|
|
3
|
-
|
|
4
|
-
fetch('/assets/module-federation.manifest.json')
|
|
5
|
-
.then((res) => res.json())
|
|
6
|
-
.then((remotes: Record<string, string>) =>
|
|
7
|
-
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
|
|
8
|
-
)
|
|
9
|
-
.then((remotes) => registerRemotes(remotes))
|
|
10
|
-
.then(() => import('./bootstrap').catch(err => console.error(err)));
|
|
11
|
-
<%_ } else { _%>
|
|
12
|
-
import('./bootstrap').catch(err => console.error(err));
|
|
13
|
-
<%_ } _%>
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
<%_ if (!minimal) { _%>
|
|
3
|
-
import NxWelcome from "./nx-welcome";
|
|
4
|
-
<%_ } _%>
|
|
5
|
-
import { Link, Route, Routes } from 'react-router-dom';
|
|
6
|
-
|
|
7
|
-
<%_ if (dynamic && remotes.length > 0) { _%>
|
|
8
|
-
import { loadRemote } from '@module-federation/enhanced/runtime';
|
|
9
|
-
<%_ } _%>
|
|
10
|
-
|
|
11
|
-
<%_ if (remotes.length > 0) {
|
|
12
|
-
remotes.forEach(function(r) { _%>
|
|
13
|
-
<%_ if (dynamic) { _%>
|
|
14
|
-
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
|
|
15
|
-
<%_ } else { _%>
|
|
16
|
-
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
|
|
17
|
-
<%_ } _%>
|
|
18
|
-
<%_ }); _%>
|
|
19
|
-
<%_ } _%>
|
|
20
|
-
|
|
21
|
-
export function App() {
|
|
22
|
-
return (
|
|
23
|
-
<React.Suspense fallback={null}>
|
|
24
|
-
<ul>
|
|
25
|
-
<li><Link to="/">Home</Link></li>
|
|
26
|
-
<%_ remotes.forEach(function(r) { _%>
|
|
27
|
-
<li><Link to="/<%=r.fileName%>"><%=r.className%></Link></li>
|
|
28
|
-
<%_ }); _%>
|
|
29
|
-
</ul>
|
|
30
|
-
<Routes>
|
|
31
|
-
<%_ if (!minimal) { _%>
|
|
32
|
-
<Route path="/" element={<NxWelcome title="<%= projectName %>"/>} />
|
|
33
|
-
<%_ } _%>
|
|
34
|
-
<%_ remotes.forEach(function(r) { _%>
|
|
35
|
-
<Route path="/<%=r.fileName%>" element={<<%= r.className %>/>} />
|
|
36
|
-
<%_ }); _%>
|
|
37
|
-
</Routes>
|
|
38
|
-
</React.Suspense>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default App;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<%_ if (dynamic) { _%>
|
|
2
|
-
import { init } from '@module-federation/enhanced/runtime';
|
|
3
|
-
|
|
4
|
-
fetch('/assets/module-federation.manifest.json')
|
|
5
|
-
.then((res) => res.json())
|
|
6
|
-
.then((remotes: Record<string, string>) =>
|
|
7
|
-
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
|
|
8
|
-
)
|
|
9
|
-
.then((remotes) => init({ name: '<%= projectName %>', remotes }))
|
|
10
|
-
.then(() => import('./bootstrap').catch(err => console.error(err)));
|
|
11
|
-
<%_ } else { _%>
|
|
12
|
-
import('./bootstrap').catch(err => console.error(err));
|
|
13
|
-
<%_ } _%>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"types": [
|
|
6
|
-
"node",
|
|
7
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
8
|
-
"@nx/react/typings/image.d.ts"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*.js",
|
|
13
|
-
"src/**/*.jsx",
|
|
14
|
-
"src/**/*.ts",
|
|
15
|
-
"src/**/*.tsx",
|
|
16
|
-
"webpack.config.ts",
|
|
17
|
-
"webpack.prod.config.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|
package/dist/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
3
|
-
**/
|
|
4
|
-
module.exports = {
|
|
5
|
-
name: '<%= projectName %>',
|
|
6
|
-
/**
|
|
7
|
-
* To use a remote that does not exist in your current Nx Workspace
|
|
8
|
-
* You can use the tuple-syntax to define your remote
|
|
9
|
-
*
|
|
10
|
-
* remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']]
|
|
11
|
-
*
|
|
12
|
-
* You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the
|
|
13
|
-
* following content:
|
|
14
|
-
*
|
|
15
|
-
* declare module 'my-external-remote';
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
remotes: [
|
|
19
|
-
<%_ if (static) {
|
|
20
|
-
remotes.forEach(function(r) { _%>
|
|
21
|
-
"<%= r.fileName %>",
|
|
22
|
-
<%_ }); } _%>
|
|
23
|
-
],
|
|
24
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
|
|
2
|
-
const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
|
|
3
|
-
const { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } = require('@nx/module-federation/rspack');
|
|
4
|
-
const { join } = require('path');
|
|
5
|
-
|
|
6
|
-
const config = require('./module-federation.config');
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
// rspack-cli dev mode defaults this on; it breaks module federation.
|
|
10
|
-
lazyCompilation: false,
|
|
11
|
-
output: {
|
|
12
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>'),
|
|
13
|
-
publicPath: 'auto'
|
|
14
|
-
},
|
|
15
|
-
devServer: {
|
|
16
|
-
port: <%= port %>,
|
|
17
|
-
historyApiFallback: {
|
|
18
|
-
index: '/index.html',
|
|
19
|
-
disableDotRule: true,
|
|
20
|
-
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
plugins: [
|
|
24
|
-
new NxAppRspackPlugin({
|
|
25
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
26
|
-
main: '<%= rspackPluginOptions.main %>',
|
|
27
|
-
index: '<%= rspackPluginOptions.index %>',
|
|
28
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
29
|
-
assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
|
|
30
|
-
styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
|
|
31
|
-
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
32
|
-
optimization: process.env['NODE_ENV'] === 'production',
|
|
33
|
-
}),
|
|
34
|
-
new NxReactRspackPlugin({
|
|
35
|
-
// Uncomment this line if you don't want to use SVGR
|
|
36
|
-
// See: https://react-svgr.com/
|
|
37
|
-
// svgr: false
|
|
38
|
-
}),
|
|
39
|
-
new NxModuleFederationPlugin({ config }, { dts: false }),
|
|
40
|
-
new NxModuleFederationDevServerPlugin({ config }),
|
|
41
|
-
],
|
|
42
|
-
};
|
package/dist/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
|
|
2
|
-
const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
|
|
3
|
-
const { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } = require('@nx/module-federation/rspack');
|
|
4
|
-
const { join } = require('path');
|
|
5
|
-
|
|
6
|
-
const baseConfig = require('./module-federation.config');
|
|
7
|
-
|
|
8
|
-
const prodConfig = {
|
|
9
|
-
...baseConfig,
|
|
10
|
-
/*
|
|
11
|
-
* Remote overrides for production.
|
|
12
|
-
* Each entry is a pair of a unique name and the URL where it is deployed.
|
|
13
|
-
*
|
|
14
|
-
* e.g.
|
|
15
|
-
* remotes: [
|
|
16
|
-
* ['app1', 'http://app1.example.com'],
|
|
17
|
-
* ['app2', 'http://app2.example.com'],
|
|
18
|
-
* ]
|
|
19
|
-
*
|
|
20
|
-
* You can also use a full path to the remoteEntry.js file if desired.
|
|
21
|
-
*
|
|
22
|
-
* remotes: [
|
|
23
|
-
* ['app1', 'http://example.com/path/to/app1/remoteEntry.js'],
|
|
24
|
-
* ['app2', 'http://example.com/path/to/app2/remoteEntry.js'],
|
|
25
|
-
* ]
|
|
26
|
-
*/
|
|
27
|
-
remotes: [
|
|
28
|
-
<%_ remotes.forEach(function(r) { _%>
|
|
29
|
-
['<%= r.fileName %>', 'http://localhost:<%= r.port %>/'],
|
|
30
|
-
<%_ }); _%>
|
|
31
|
-
],
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
module.exports = {
|
|
35
|
-
output: {
|
|
36
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>'),
|
|
37
|
-
publicPath: 'auto'
|
|
38
|
-
},
|
|
39
|
-
devServer: {
|
|
40
|
-
port: <%= port %>,
|
|
41
|
-
historyApiFallback: {
|
|
42
|
-
index: '/index.html',
|
|
43
|
-
disableDotRule: true,
|
|
44
|
-
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
plugins: [
|
|
48
|
-
new NxAppRspackPlugin({
|
|
49
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
50
|
-
main: '<%= rspackPluginOptions.main %>',
|
|
51
|
-
index: '<%= rspackPluginOptions.index %>',
|
|
52
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
53
|
-
assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
|
|
54
|
-
styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
|
|
55
|
-
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
56
|
-
optimization: process.env['NODE_ENV'] === 'production',
|
|
57
|
-
}),
|
|
58
|
-
new NxReactRspackPlugin({
|
|
59
|
-
// Uncomment this line if you don't want to use SVGR
|
|
60
|
-
// See: https://react-svgr.com/
|
|
61
|
-
// svgr: false
|
|
62
|
-
}),
|
|
63
|
-
new NxModuleFederationPlugin({ config: prodConfig }, { dts: false }),
|
|
64
|
-
new NxModuleFederationDevServerPlugin({ config: prodConfig }),
|
|
65
|
-
],
|
|
66
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {import('@nx/module-federation').ModuleFederationConfig}
|
|
5
|
-
**/
|
|
6
|
-
const moduleFederationConfig = {
|
|
7
|
-
name: '<%= projectName %>',
|
|
8
|
-
remotes: [
|
|
9
|
-
<%_ if (static) {
|
|
10
|
-
remotes.forEach(function(r) { _%>
|
|
11
|
-
"<%= r.fileName %>",
|
|
12
|
-
<%_ });
|
|
13
|
-
}
|
|
14
|
-
_%>
|
|
15
|
-
],
|
|
16
|
-
shared: (libraryName, libraryConfig) => {
|
|
17
|
-
return {
|
|
18
|
-
...libraryConfig,
|
|
19
|
-
eager: true
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
26
|
-
**/
|
|
27
|
-
module.exports = moduleFederationConfig;
|
package/dist/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
|
|
2
|
-
const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
|
|
3
|
-
const { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } = require('@nx/module-federation/rspack');
|
|
4
|
-
const { join } = require('path');
|
|
5
|
-
|
|
6
|
-
const browserMfConfig = require('./module-federation.config');
|
|
7
|
-
const serverMfConfig = require('./module-federation.server.config');
|
|
8
|
-
|
|
9
|
-
const browserRspackConfig = {
|
|
10
|
-
name: 'browser',
|
|
11
|
-
// rspack-cli dev mode defaults this on; it breaks module federation.
|
|
12
|
-
lazyCompilation: false,
|
|
13
|
-
output: {
|
|
14
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'browser'),
|
|
15
|
-
publicPath: 'auto'
|
|
16
|
-
},
|
|
17
|
-
devServer: {
|
|
18
|
-
port: <%= port %>,
|
|
19
|
-
historyApiFallback: {
|
|
20
|
-
index: '/index.html',
|
|
21
|
-
disableDotRule: true,
|
|
22
|
-
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
|
23
|
-
},
|
|
24
|
-
devMiddleware: {
|
|
25
|
-
writeToDisk: (file: string) => !file.includes('.hot-update.'),
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
plugins: [
|
|
29
|
-
new NxAppRspackPlugin({
|
|
30
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
31
|
-
main: '<%= rspackPluginOptions.main %>',
|
|
32
|
-
index: '<%= rspackPluginOptions.index %>',
|
|
33
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
34
|
-
assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
|
|
35
|
-
styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
|
|
36
|
-
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
37
|
-
optimization: process.env['NODE_ENV'] === 'production',
|
|
38
|
-
}),
|
|
39
|
-
new NxReactRspackPlugin({
|
|
40
|
-
// Uncomment this line if you don't want to use SVGR
|
|
41
|
-
// See: https://react-svgr.com/
|
|
42
|
-
// svgr: false
|
|
43
|
-
}),
|
|
44
|
-
new NxModuleFederationPlugin({ config: browserMfConfig }, { dts: false }),
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const serverRspackConfig = {
|
|
49
|
-
name: 'server',
|
|
50
|
-
target: 'async-node',
|
|
51
|
-
output: {
|
|
52
|
-
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'server'),
|
|
53
|
-
filename: 'server.js'
|
|
54
|
-
},
|
|
55
|
-
plugins: [
|
|
56
|
-
new NxAppRspackPlugin({
|
|
57
|
-
outputPath: join(__dirname, '<%= rspackPluginOptions.outputPath %>', 'server'),
|
|
58
|
-
outputFileName: 'server.js',
|
|
59
|
-
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
60
|
-
main: '<%= rspackPluginOptions.mainServer %>',
|
|
61
|
-
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
62
|
-
}),
|
|
63
|
-
new NxModuleFederationPlugin({ config: serverMfConfig, isServer: true }, { dts: false }),
|
|
64
|
-
new NxModuleFederationSSRDevServerPlugin({ config: serverMfConfig }),
|
|
65
|
-
],
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
module.exports = [browserRspackConfig, serverRspackConfig];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import express from 'express';
|
|
3
|
-
import cors from 'cors';
|
|
4
|
-
|
|
5
|
-
import { handleRequest } from './src/main.server';
|
|
6
|
-
|
|
7
|
-
const port = process.env['PORT'] || <%= port %>;
|
|
8
|
-
const app = express();
|
|
9
|
-
|
|
10
|
-
const browserDist = path.join(process.cwd(), '<%= rspackPluginOptions.outputPath %>', 'browser');
|
|
11
|
-
const indexPath = path.join(browserDist, 'index.html');
|
|
12
|
-
|
|
13
|
-
app.use(cors());
|
|
14
|
-
|
|
15
|
-
app.get(
|
|
16
|
-
'*.*',
|
|
17
|
-
express.static(browserDist, {
|
|
18
|
-
maxAge: '1y',
|
|
19
|
-
})
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
app.use('*', handleRequest(indexPath));
|
|
23
|
-
|
|
24
|
-
const server = app.listen(port, () => {
|
|
25
|
-
console.log(`Express server listening on http://localhost:${port}`);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
server.on('error', console.error);
|
package/dist/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as ReactDOMServer from 'react-dom/server';
|
|
4
|
-
import isbot from 'isbot'
|
|
5
|
-
|
|
6
|
-
import App from './app/app';
|
|
7
|
-
|
|
8
|
-
import { StaticRouter } from 'react-router-dom/server';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let indexHtml: null | string = null;
|
|
12
|
-
|
|
13
|
-
export function handleRequest(indexPath: string) {
|
|
14
|
-
return function render(req: Request, res: Response) {
|
|
15
|
-
let didError = false;
|
|
16
|
-
|
|
17
|
-
if (!indexHtml) {
|
|
18
|
-
indexHtml = fs.readFileSync(indexPath).toString();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const [htmlStart, htmlEnd] = indexHtml.split(`<div id="root"></div>`);
|
|
22
|
-
|
|
23
|
-
// For bots (e.g. search engines), the content will not be streamed but render all at once.
|
|
24
|
-
// For users, content should be streamed to the user as they are ready.
|
|
25
|
-
const callbackName = isbot(req.headers['user-agent']) ? 'onAllReady' : 'onShellReady';
|
|
26
|
-
|
|
27
|
-
const stream = ReactDOMServer.renderToPipeableStream(
|
|
28
|
-
<StaticRouter location={req.originalUrl}><App /></StaticRouter>,
|
|
29
|
-
{
|
|
30
|
-
[callbackName]() {
|
|
31
|
-
res.statusCode = didError ? 500 : 200;
|
|
32
|
-
res.setHeader('Content-type', 'text/html; charset=utf-8');
|
|
33
|
-
res.write(`${htmlStart}<div id="root">`);
|
|
34
|
-
stream.pipe(res);
|
|
35
|
-
res.write(`</div>${htmlEnd}`);
|
|
36
|
-
},
|
|
37
|
-
onShellError(error) {
|
|
38
|
-
console.error(error);
|
|
39
|
-
res.statusCode = 500;
|
|
40
|
-
res.send('<!doctype html><h1>Server Error</h1>');
|
|
41
|
-
},
|
|
42
|
-
onError(error) {
|
|
43
|
-
didError = true;
|
|
44
|
-
console.error(error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
}
|
package/dist/src/generators/host/files/rspack-module-federation-ssr/tsconfig.server.json__tmpl__
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.app.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../out-tsc/server",
|
|
5
|
-
"target": "es2019",
|
|
6
|
-
"types": [
|
|
7
|
-
"node",
|
|
8
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
-
"@nx/react/typings/image.d.ts"
|
|
10
|
-
]
|
|
11
|
-
},
|
|
12
|
-
"include": [
|
|
13
|
-
"src/remotes.d.ts",
|
|
14
|
-
"src/main.server.tsx",
|
|
15
|
-
"server.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ModuleFederationConfig } from '@nx/module-federation';
|
|
2
|
-
|
|
3
|
-
const config: ModuleFederationConfig = {
|
|
4
|
-
name: '<%= projectName %>',
|
|
5
|
-
remotes: [
|
|
6
|
-
<%_ if (static) {
|
|
7
|
-
remotes.forEach(function(r) { _%>
|
|
8
|
-
"<%= r.fileName %>",
|
|
9
|
-
<%_ }); } _%>
|
|
10
|
-
],
|
|
11
|
-
shared: (libraryName, libraryConfig) => {
|
|
12
|
-
return {
|
|
13
|
-
...libraryConfig,
|
|
14
|
-
eager: true
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
|
|
21
|
-
**/
|
|
22
|
-
export default config;
|