Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to react and vue to @module-federation/enhanced #27613

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
});
_&>

const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
const { ModuleFederationPlugin } = require('@module-federation/enhanced/webpack');
<&- fragments.importsSection() &>
<%_ if (!clientFrameworkVue) { _%>
const packageJson = require('../package.json');
Expand Down Expand Up @@ -63,6 +63,8 @@ module.exports = () => {
filename: 'remoteEntry.js',
<%_ } _%>
shareScope: 'default',
dts: false,
manifest: false,
<&- fragments.moduleFederationSection() &>
}
<%_ } -%>
Expand All @@ -71,6 +73,7 @@ module.exports = () => {
],
output: {
publicPath: 'auto',
scriptType: 'text/javascript',
},
};
};
12 changes: 12 additions & 0 deletions generators/react/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ export default class ReactGenerator extends BaseApplicationGenerator {

get postWriting() {
return this.asPostWritingTaskGroup({
addMicrofrontendDependencies({ application }) {
if (!application.microfrontend) return;
const { applicationTypeGateway } = application;
if (applicationTypeGateway) {
this.packageJson.merge({
devDependencies: { '@module-federation/utilities': null },
});
}
this.packageJson.merge({
devDependencies: { '@module-federation/enhanced': null },
});
},
addWebsocketDependencies({ application }) {
const { communicationSpringWebsocket, nodeDependencies } = application;
if (communicationSpringWebsocket) {
Expand Down
1 change: 1 addition & 0 deletions generators/react/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"devDependencies": {
"@eslint/js": "9.12.0",
"@module-federation/enhanced": "0.6.11",
"@module-federation/utilities": "3.1.17",
"@testing-library/react": "16.0.1",
"@types/jest": "29.5.13",
Expand Down
3 changes: 0 additions & 3 deletions generators/react/templates/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
"uuid": "<%= nodeDependencies['uuid'] %>"
},
"devDependencies": {
<%_ if (applicationTypeGateway && microfrontend) { _%>
"@module-federation/utilities": "<%= nodeDependencies['@module-federation/utilities'] %>",
<%_ } _%>
"@testing-library/react": "<%= nodeDependencies['@testing-library/react'] %>",
"@types/jest": "<%= nodeDependencies['@types/jest'] %>",
"@types/lodash": "<%= nodeDependencies['@types/lodash'] %>",
Expand Down
1 change: 1 addition & 0 deletions generators/vue/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export default class VueGenerator extends BaseApplicationGenerator {
}
this.packageJson.merge({
devDependencies: {
'@module-federation/enhanced': null,
'browser-sync-webpack-plugin': null,
'copy-webpack-plugin': null,
'css-loader': null,
Expand Down
1 change: 1 addition & 0 deletions generators/vue/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"devDependencies": {
"@eslint/js": "9.12.0",
"@module-federation/enhanced": "0.6.11",
"@module-federation/utilities": "3.1.17",
"@pinia/testing": "0.1.6",
"@tsconfig/node18": "18.2.4",
Expand Down
2 changes: 2 additions & 0 deletions generators/vue/templates/module-federation.config.cjs.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ module.exports = {
'@/locale/translation.service',
),
},
dts: false,
manifest: false,
};
Loading