-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(module-federation): remote names should follow js variable naming…
… schema
- Loading branch information
Showing
5 changed files
with
242 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 179 additions & 0 deletions
179
packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files 1`] = ` | ||
"const { composePlugins, withNx, withReact } = require('@nx/rspack'); | ||
const { withModuleFederation } = require('@nx/rspack/module-federation'); | ||
const baseConfig = require('./module-federation.config'); | ||
const config = { | ||
...baseConfig, | ||
}; | ||
// Nx plugins for rspack to build config object from Nx options and context. | ||
/** | ||
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation | ||
* The DTS Plugin can be enabled by setting dts: true | ||
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html | ||
*/ | ||
module.exports = composePlugins(withNx(), withReact(), withModuleFederation(config, { dts: false })); | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files 2`] = `"module.exports = require('./rspack.config');"`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files 3`] = ` | ||
"module.exports = { | ||
name: 'test', | ||
exposes: { | ||
'./Module': './src/remote-entry.ts', | ||
}, | ||
}; | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files when --js=true 1`] = ` | ||
"const { composePlugins, withNx, withReact } = require('@nx/rspack'); | ||
const { withModuleFederation } = require('@nx/rspack/module-federation'); | ||
const baseConfig = require('./module-federation.config'); | ||
const config = { | ||
...baseConfig, | ||
}; | ||
// Nx plugins for rspack to build config object from Nx options and context. | ||
/** | ||
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation | ||
* The DTS Plugin can be enabled by setting dts: true | ||
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html | ||
*/ | ||
module.exports = composePlugins(withNx(), withReact(), withModuleFederation(config, { dts: false })); | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files when --js=true 2`] = `"module.exports = require('./rspack.config');"`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files when --js=true 3`] = ` | ||
"module.exports = { | ||
name: 'test', | ||
exposes: { | ||
'./Module': './src/remote-entry.js', | ||
}, | ||
}; | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files when --typescriptConfiguration=true 1`] = ` | ||
"import { composePlugins, withNx, withReact } from '@nx/rspack'; | ||
import { withModuleFederation } from '@nx/rspack/module-federation'; | ||
import baseConfig from './module-federation.config'; | ||
const config = { | ||
...baseConfig, | ||
}; | ||
// Nx plugins for rspack to build config object from Nx options and context. | ||
/** | ||
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation | ||
* The DTS Plugin can be enabled by setting dts: true | ||
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html | ||
*/ | ||
export default composePlugins( | ||
withNx(), | ||
withReact(), | ||
withModuleFederation(config, { dts: false }) | ||
); | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files when --typescriptConfiguration=true 2`] = ` | ||
"export default require('./rspack.config'); | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should create the remote with the correct config files when --typescriptConfiguration=true 3`] = ` | ||
"import { ModuleFederationConfig } from '@nx/rspack/module-federation'; | ||
const config: ModuleFederationConfig = { | ||
name: 'test', | ||
exposes: { | ||
'./Module': './src/remote-entry.ts', | ||
}, | ||
}; | ||
export default config; | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should generate correct remote with config files when using --ssr 1`] = ` | ||
"const {composePlugins, withNx, withReact} = require('@nx/rspack'); | ||
const {withModuleFederationForSSR} = require('@nx/rspack/module-federation'); | ||
const baseConfig = require("./module-federation.server.config"); | ||
const defaultConfig = { | ||
...baseConfig, | ||
}; | ||
// Nx plugins for rspack to build config object from Nx options and context. | ||
/** | ||
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation | ||
* The DTS Plugin can be enabled by setting dts: true | ||
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html | ||
*/ | ||
module.exports = composePlugins(withNx(), withReact({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false })); | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should generate correct remote with config files when using --ssr 2`] = ` | ||
"module.exports = { | ||
name: 'test', | ||
exposes: { | ||
'./Module': './src/remote-entry.ts', | ||
}, | ||
}; | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should generate correct remote with config files when using --ssr and --typescriptConfiguration=true 1`] = ` | ||
"import { composePlugins, withNx, withReact } from '@nx/rspack'; | ||
import { withModuleFederationForSSR } from '@nx/rspack/module-federation'; | ||
import baseConfig from './module-federation.server.config'; | ||
const defaultConfig = { | ||
...baseConfig, | ||
}; | ||
// Nx plugins for rspack to build config object from Nx options and context. | ||
/** | ||
* DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation | ||
* The DTS Plugin can be enabled by setting dts: true | ||
* Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html | ||
*/ | ||
export default composePlugins( | ||
withNx(), | ||
withReact({ ssr: true }), | ||
withModuleFederationForSSR(defaultConfig, { dts: false }) | ||
); | ||
" | ||
`; | ||
|
||
exports[`remote generator bundler=rspack should generate correct remote with config files when using --ssr and --typescriptConfiguration=true 2`] = ` | ||
"import { ModuleFederationConfig } from '@nx/rspack/module-federation'; | ||
const config: ModuleFederationConfig = { | ||
name: 'test', | ||
exposes: { | ||
'./Module': './src/remote-entry.ts', | ||
}, | ||
}; | ||
export default config; | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters