@nx/react 17.2.6 → 17.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/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
<p style="text-align: center;"
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
8
|
<div style="text-align: center;">
|
|
4
9
|
|
|
@@ -15,9 +20,9 @@
|
|
|
15
20
|
|
|
16
21
|
<hr>
|
|
17
22
|
|
|
18
|
-
# Nx: Smart
|
|
23
|
+
# Nx: Smart Monorepos · Fast CI
|
|
19
24
|
|
|
20
|
-
Nx is a
|
|
25
|
+
Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
|
|
21
26
|
|
|
22
27
|
This package is a [React plugin for Nx](https://nx.dev/packages/react).
|
|
23
28
|
|
|
@@ -59,5 +64,5 @@ npx nx@latest init
|
|
|
59
64
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
60
65
|
|
|
61
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"
|
|
62
|
-
width="100%" alt="Nx - Smart
|
|
67
|
+
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
|
63
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"file-loader": "^6.2.0",
|
|
38
38
|
"minimatch": "3.0.5",
|
|
39
39
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/devkit": "17.
|
|
41
|
-
"@nx/js": "17.
|
|
42
|
-
"@nx/eslint": "17.
|
|
43
|
-
"@nx/web": "17.
|
|
44
|
-
"@nrwl/react": "17.
|
|
40
|
+
"@nx/devkit": "17.3.0-beta.1",
|
|
41
|
+
"@nx/js": "17.3.0-beta.1",
|
|
42
|
+
"@nx/eslint": "17.3.0-beta.1",
|
|
43
|
+
"@nx/web": "17.3.0-beta.1",
|
|
44
|
+
"@nrwl/react": "17.3.0-beta.1"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -3,16 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withModuleFederation = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
|
|
6
|
+
const isVarOrWindow = (libType) => libType === 'var' || libType === 'window';
|
|
6
7
|
/**
|
|
7
8
|
* @param {ModuleFederationConfig} options
|
|
8
9
|
* @return {Promise<AsyncNxComposableWebpackPlugin>}
|
|
9
10
|
*/
|
|
10
11
|
async function withModuleFederation(options) {
|
|
11
12
|
const { sharedDependencies, sharedLibraries, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options);
|
|
13
|
+
const isGlobal = isVarOrWindow(options.library?.type);
|
|
12
14
|
return (config, ctx) => {
|
|
13
15
|
config.output.uniqueName = options.name;
|
|
14
16
|
config.output.publicPath = 'auto';
|
|
15
|
-
if (
|
|
17
|
+
if (isGlobal) {
|
|
16
18
|
config.output.scriptType = 'text/javascript';
|
|
17
19
|
}
|
|
18
20
|
config.optimization = {
|
|
@@ -20,7 +22,7 @@ async function withModuleFederation(options) {
|
|
|
20
22
|
};
|
|
21
23
|
config.experiments = {
|
|
22
24
|
...config.experiments,
|
|
23
|
-
outputModule: !
|
|
25
|
+
outputModule: !isGlobal,
|
|
24
26
|
};
|
|
25
27
|
config.plugins.push(new ModuleFederationPlugin({
|
|
26
28
|
name: options.name,
|
|
@@ -37,7 +39,7 @@ async function withModuleFederation(options) {
|
|
|
37
39
|
* { appX: 'appX@http://localhost:3001/remoteEntry.js' }
|
|
38
40
|
* { appY: 'appY@http://localhost:3002/remoteEntry.js' }
|
|
39
41
|
*/
|
|
40
|
-
...(
|
|
42
|
+
...(isGlobal ? { remoteType: 'script' } : {}),
|
|
41
43
|
}), sharedLibraries.getReplacementPlugin());
|
|
42
44
|
return config;
|
|
43
45
|
};
|