diff --git a/packages/angular/src/generators/host/__snapshots__/host.spec.ts.snap b/packages/angular/src/generators/host/__snapshots__/host.spec.ts.snap index 299b421a180ca..78e914474c360 100644 --- a/packages/angular/src/generators/host/__snapshots__/host.spec.ts.snap +++ b/packages/angular/src/generators/host/__snapshots__/host.spec.ts.snap @@ -232,7 +232,10 @@ exports[`Host App Generator --ssr should generate the correct files 5`] = ` `; exports[`Host App Generator --ssr should generate the correct files 6`] = ` -"module.exports = { +"/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ +module.exports = { name: 'test', /** * To use a remote that does not exist in your current Nx Workspace @@ -421,7 +424,10 @@ exports[`Host App Generator --ssr should generate the correct files for standalo `; exports[`Host App Generator --ssr should generate the correct files for standalone 5`] = ` -"module.exports = { +"/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ +module.exports = { name: 'test', /** * To use a remote that does not exist in your current Nx Workspace @@ -655,6 +661,9 @@ const config: ModuleFederationConfig = { remotes: [] }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; @@ -890,6 +899,9 @@ const config: ModuleFederationConfig = { remotes: [] }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; diff --git a/packages/angular/src/generators/remote/__snapshots__/remote.spec.ts.snap b/packages/angular/src/generators/remote/__snapshots__/remote.spec.ts.snap index 45f0a299d87af..d512162ddc940 100644 --- a/packages/angular/src/generators/remote/__snapshots__/remote.spec.ts.snap +++ b/packages/angular/src/generators/remote/__snapshots__/remote.spec.ts.snap @@ -206,7 +206,10 @@ exports[`MF Remote App Generator --ssr should generate the correct files 5`] = ` `; exports[`MF Remote App Generator --ssr should generate the correct files 6`] = ` -"module.exports = { +"/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ +module.exports = { name: 'test', exposes: { './Module': 'test/src/app/remote-entry/entry.module.ts', @@ -441,6 +444,9 @@ const config: ModuleFederationConfig = { }, }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; @@ -623,7 +629,10 @@ bootstrapApplication(RemoteEntryComponent, appConfig).catch((err) => `; exports[`MF Remote App Generator should generate the a remote setup for standalone components 2`] = ` -"module.exports = { +"/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ +module.exports = { name: 'test', exposes: { './Routes': 'test/src/app/remote-entry/entry.routes.ts', @@ -691,6 +700,9 @@ const config: ModuleFederationConfig = { }, }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; diff --git a/packages/angular/src/generators/setup-mf/__snapshots__/setup-mf.spec.ts.snap b/packages/angular/src/generators/setup-mf/__snapshots__/setup-mf.spec.ts.snap index 29a97e6509459..8e908a8bc759d 100644 --- a/packages/angular/src/generators/setup-mf/__snapshots__/setup-mf.spec.ts.snap +++ b/packages/angular/src/generators/setup-mf/__snapshots__/setup-mf.spec.ts.snap @@ -73,7 +73,10 @@ export const appRoutes: Route[] = [ `; exports[`Init MF should add a remote application and add it to a specified host applications webpack config that contains a remote application already 1`] = ` -"module.exports = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'app1', /** * To use a remote that does not exist in your current Nx Workspace @@ -112,12 +115,18 @@ const config: ModuleFederationConfig = { remotes: ['remote1','remote2',] }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; exports[`Init MF should add a remote application and add it to a specified host applications webpack config when no other remote has been added to it 1`] = ` -"module.exports = { +"/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ +module.exports = { name: 'app1', /** * To use a remote that does not exist in your current Nx Workspace @@ -156,6 +165,9 @@ const config: ModuleFederationConfig = { remotes: ['remote1',] }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; @@ -208,7 +220,10 @@ module.exports = withModuleFederation(config, { dts: false }); `; exports[`Init MF should create webpack and mf configs correctly 2`] = ` -"module.exports = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'app1', /** * To use a remote that does not exist in your current Nx Workspace @@ -241,7 +256,10 @@ module.exports = withModuleFederation(config, { dts: false }); `; exports[`Init MF should create webpack and mf configs correctly 4`] = ` -"module.exports = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'remote1', exposes: { './Module': 'remote1/src/app/remote-entry/entry.module.ts', @@ -283,6 +301,9 @@ const config: ModuleFederationConfig = { remotes: [] }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; @@ -310,6 +331,9 @@ const config: ModuleFederationConfig = { }, }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; diff --git a/packages/angular/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ b/packages/angular/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ index 52d7d6cf9d122..cba0f9abd5a0b 100644 --- a/packages/angular/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +++ b/packages/angular/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ @@ -21,4 +21,7 @@ const config: ModuleFederationConfig = { },<% } %> }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/angular/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ b/packages/angular/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ index d2014b48c86e7..0fc24d6c7ca7b 100644 --- a/packages/angular/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +++ b/packages/angular/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ @@ -1,3 +1,6 @@ +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = { name: '<%= name %>',<% if(type === 'host') { %> /** diff --git a/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap b/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap index d0743ef5f866d..e2c2ed26f8de3 100644 --- a/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap +++ b/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap @@ -36,6 +36,9 @@ const moduleFederationConfig = { remotes: [], }; +/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ module.exports = moduleFederationConfig; " `; @@ -73,6 +76,9 @@ const config: ModuleFederationConfig = { remotes: [], }; +/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ export default config; " `; @@ -103,7 +109,10 @@ module.exports = composePlugins( `; exports[`hostGenerator bundler=webpack should generate host files and configs when --typescriptConfiguration=false 2`] = ` -"module.exports = { +"/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ +module.exports = { name: 'test', /** * To use a remote that does not exist in your current Nx Workspace @@ -165,6 +174,9 @@ const config: ModuleFederationConfig = { ], }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; " `; diff --git a/packages/react/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ b/packages/react/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ index 095da073034b3..6ce651ac3acb5 100644 --- a/packages/react/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +++ b/packages/react/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ @@ -10,4 +10,7 @@ const config: ModuleFederationConfig = { ], }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ b/packages/react/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ index d20a8c91c5f9a..0c08f62f765fb 100644 --- a/packages/react/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +++ b/packages/react/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ @@ -13,4 +13,7 @@ const moduleFederationConfig = { ], }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = moduleFederationConfig; diff --git a/packages/react/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ b/packages/react/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ index b76c2881f2fd2..cd866449770d1 100644 --- a/packages/react/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +++ b/packages/react/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ @@ -22,4 +22,7 @@ const config: ModuleFederationConfig = { ], }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ b/packages/react/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ index 04b6e6394dae8..fab2be0f32486 100644 --- a/packages/react/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +++ b/packages/react/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ @@ -1,3 +1,6 @@ +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = { name: '<%= projectName %>', /** @@ -18,4 +21,4 @@ module.exports = { } %> ], -}; \ No newline at end of file +}; diff --git a/packages/react/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ b/packages/react/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ index c64f2cff8f42e..7b9730996c03e 100644 --- a/packages/react/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +++ b/packages/react/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ @@ -10,4 +10,7 @@ const config: ModuleFederationConfig = { ], }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ b/packages/react/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ index 279f291753ff7..7e902a654be47 100644 --- a/packages/react/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +++ b/packages/react/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ @@ -13,4 +13,7 @@ const moduleFederationConfig = { ], }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = moduleFederationConfig; diff --git a/packages/react/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ b/packages/react/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ index 58f96907854f5..290c25ecaa88c 100644 --- a/packages/react/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +++ b/packages/react/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ @@ -22,4 +22,7 @@ const config: ModuleFederationConfig = { ], }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ b/packages/react/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ index 04b6e6394dae8..fab2be0f32486 100644 --- a/packages/react/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +++ b/packages/react/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ @@ -1,3 +1,6 @@ +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = { name: '<%= projectName %>', /** @@ -18,4 +21,4 @@ module.exports = { } %> ], -}; \ No newline at end of file +}; diff --git a/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap b/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap index 31c7933533f6d..8982659954a23 100644 --- a/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap +++ b/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap @@ -23,7 +23,10 @@ module.exports = composePlugins(withNx(), withReact(), withModuleFederation(conf 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 = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'test', exposes: { @@ -56,7 +59,10 @@ module.exports = composePlugins(withNx(), withReact(), withModuleFederation(conf 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 = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'test', exposes: { @@ -106,6 +112,9 @@ const config: ModuleFederationConfig = { }, }; +/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ export default config; " `; @@ -131,7 +140,10 @@ module.exports = composePlugins(withNx(), withReact({ssr: true}), withModuleFede `; exports[`remote generator bundler=rspack should generate correct remote with config files when using --ssr 2`] = ` -"module.exports = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'test', exposes: { './Module': './src/remote-entry.ts', @@ -174,6 +186,9 @@ const config: ModuleFederationConfig = { }, }; +/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ export default config; " `; diff --git a/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap b/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap index b2e3367a079ab..1f59c12295219 100644 --- a/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap +++ b/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap @@ -24,7 +24,10 @@ module.exports = composePlugins(withNx(), withReact(), withModuleFederation(conf exports[`remote generator bundler=webpack should create the remote with the correct config files 2`] = `"module.exports = require('./webpack.config');"`; exports[`remote generator bundler=webpack should create the remote with the correct config files 3`] = ` -"module.exports = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'test', exposes: { @@ -58,7 +61,10 @@ module.exports = composePlugins(withNx(), withReact(), withModuleFederation(conf exports[`remote generator bundler=webpack should create the remote with the correct config files when --js=true 2`] = `"module.exports = require('./webpack.config');"`; exports[`remote generator bundler=webpack should create the remote with the correct config files when --js=true 3`] = ` -"module.exports = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'test', exposes: { @@ -109,6 +115,9 @@ const config: ModuleFederationConfig = { }, }; +/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ export default config; " `; @@ -135,7 +144,10 @@ module.exports = composePlugins(withNx(), withReact({ssr: true}), withModuleFede `; exports[`remote generator bundler=webpack should generate correct remote with config files when using --ssr 2`] = ` -"module.exports = { +"/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ +module.exports = { name: 'test', exposes: { './Module': 'test/src/remote-entry.ts', @@ -179,6 +191,9 @@ const config: ModuleFederationConfig = { }, }; +/** + * Nx requires a default export of the config to allow correct resolution of the module federation graph. + **/ export default config; " `; diff --git a/packages/react/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ b/packages/react/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ index 75b68d2082012..c201c20af9efa 100644 --- a/packages/react/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +++ b/packages/react/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ @@ -7,4 +7,7 @@ const config: ModuleFederationConfig = { }, }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ b/packages/react/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ index a24cbeabb6df9..c60b14b4f8b34 100644 --- a/packages/react/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +++ b/packages/react/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ @@ -1,3 +1,6 @@ +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = { name: '<%= projectName %>', exposes: { diff --git a/packages/react/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ b/packages/react/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ index b2e98cfaa5fbe..25d81f6305f9f 100644 --- a/packages/react/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +++ b/packages/react/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ @@ -10,4 +10,7 @@ const config: ModuleFederationConfig = { }, }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ b/packages/react/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ index da1a17ef1c16d..852011cfb9e82 100644 --- a/packages/react/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +++ b/packages/react/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ @@ -1,3 +1,6 @@ +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = { name: '<%= projectName %>', <% if (dynamic) { %> diff --git a/packages/react/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ b/packages/react/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ index c2359ff000924..f91e75b4366aa 100644 --- a/packages/react/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +++ b/packages/react/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ @@ -7,4 +7,7 @@ const config: ModuleFederationConfig = { }, }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ b/packages/react/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ index 2859c54edcc18..3e2b447f9832f 100644 --- a/packages/react/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +++ b/packages/react/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ @@ -1,3 +1,6 @@ +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = { name: '<%= projectName %>', exposes: { diff --git a/packages/react/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ b/packages/react/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ index 01c1e928b5167..0613c7d87fdb1 100644 --- a/packages/react/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +++ b/packages/react/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ @@ -10,4 +10,7 @@ const config: ModuleFederationConfig = { }, }; +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ export default config; diff --git a/packages/react/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ b/packages/react/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ index da1a17ef1c16d..852011cfb9e82 100644 --- a/packages/react/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +++ b/packages/react/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ @@ -1,3 +1,6 @@ +/** +* Nx requires a default export of the config to allow correct resolution of the module federation graph. +**/ module.exports = { name: '<%= projectName %>', <% if (dynamic) { %>