Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(angular): use a mfe.config.js for mfe (#9495)
- Loading branch information
Showing
14 changed files
with
139 additions
and
130 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
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
44 changes: 32 additions & 12 deletions
44
...src/generators/convert-to-with-mf/lib/__snapshots__/write-new-webpack-config.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 |
---|---|---|
@@ -1,37 +1,57 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`writeNewWebpackConfig should convert config that is both remote and host correctly 1`] = ` | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
module.exports = withModuleFederation({ | ||
Array [ | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
const config = require('./mfe.config'); | ||
module.exports = withModuleFederation(config);", | ||
" | ||
module.exports = { | ||
name: 'both1', | ||
remotes: [['remote1', 'http://localhost:4201']], | ||
exposes: { | ||
'./Module': 'apps/both/src/app/remote-entry/entry.module.ts' | ||
}, | ||
});" | ||
};", | ||
] | ||
`; | ||
|
||
exports[`writeNewWebpackConfig should convert config that is neither remote and host correctly 1`] = ` | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
module.exports = withModuleFederation({ | ||
Array [ | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
const config = require('./mfe.config'); | ||
module.exports = withModuleFederation(config);", | ||
" | ||
module.exports = { | ||
name: 'neither', | ||
});" | ||
};", | ||
] | ||
`; | ||
|
||
exports[`writeNewWebpackConfig should convert host config correctly 1`] = ` | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
module.exports = withModuleFederation({ | ||
Array [ | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
const config = require('./mfe.config'); | ||
module.exports = withModuleFederation(config);", | ||
" | ||
module.exports = { | ||
name: 'host1', | ||
remotes: [['remote1', 'http://localhost:4201']], | ||
});" | ||
};", | ||
] | ||
`; | ||
|
||
exports[`writeNewWebpackConfig should convert remote config correctly 1`] = ` | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
module.exports = withModuleFederation({ | ||
Array [ | ||
"const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
const config = require('./mfe.config'); | ||
module.exports = withModuleFederation(config);", | ||
" | ||
module.exports = { | ||
name: 'remote1', | ||
exposes: { | ||
'./Module': 'apps/remote1/src/app/remote-entry/entry.module.ts' | ||
}, | ||
});" | ||
};", | ||
] | ||
`; |
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
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
7 changes: 7 additions & 0 deletions
7
packages/angular/src/generators/setup-mfe/files/webpack/mfe.config.js__tmpl__
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,7 @@ | ||
module.exports = { | ||
name: '<%= name %>',<% if(type === 'host') { %> | ||
remotes: [<% remotes.forEach(function(remote) { %>'<%= remote.remoteName %>',<% }); %>]<% } %><% if(type === 'remote') { %> | ||
exposes: { | ||
'./Module': '<%= projectRoot %>/src/app/remote-entry/entry.module.ts', | ||
},<% } %> | ||
} |
9 changes: 2 additions & 7 deletions
9
packages/angular/src/generators/setup-mfe/files/webpack/webpack.config.js__tmpl__
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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
const { withModuleFederation } = require('@nrwl/angular/module-federation'); | ||
module.exports = withModuleFederation({ | ||
name: '<%= name %>',<% if(type === 'host') { %> | ||
remotes: [<% remotes.forEach(function(remote) { %>'<%= remote.remoteName %>',<% }); %>]<% } %><% if(type === 'remote') { %> | ||
exposes: { | ||
'./Module': '<%= projectRoot %>/src/app/remote-entry/entry.module.ts', | ||
},<% } %> | ||
}); | ||
const config = require('./mfe.config'); | ||
module.exports = withModuleFederation(config); |
Oops, something went wrong.