-
Notifications
You must be signed in to change notification settings - Fork 208
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
Error with eager shared modules after update to Angular15 #253
Comments
The same happens when just one of the definitions contains
|
I think I've found the source of the problem. module-federation-plugin/libs/mf/src/utils/with-mf-plugin.ts Lines 124 to 126 in b899673
Now in the ModifyEntryPlugin the entry points for styles/polyfills/main get changed. But here
This worked fine in Angular14 because I guess compiler.options.entry always was an object. before StylesWebpackPlugin gets executed. after StylesWebpackPlugin gets executed. I think to fix the problem the ModifyEntryPlugin would need to be able to handle the case that the entries in the compiler options are already defined as a function. Hope this info helps with finding a solution. |
I investigated this issue yesterday. Support for eager and pinned was provided in June. Unfortunately, as @NicoReber has pointed out, this changes are not compatible with Angular 15 due to the new implementations for Webpack compilation in the CLI project. The We should also notice that we are now referencing polyfills as So basically this code would not be useful in if (hasEager) {
modifyEntryConfig['styles'] = { dependOn: ['main'] };
modifyEntryConfig['polyfills'] = { dependOn: ['main'] };
} So in the end I have provided a workaround in my project to avoid using this plugin: // @ts-check
const {
share,
withModuleFederationPlugin,
SharedMappings,
} = require('@angular-architects/module-federation/webpack');
const {
ModifyEntryPlugin,
} = require('@angular-architects/module-federation/src/utils/modify-entry-plugin');
const path = require('path');
const sharedMappings = new SharedMappings();
sharedMappings.register(path.join(__dirname, '../../tsconfig.json'), [
/* mapped paths to share */
]);
const remotes = require('./remotes.json');
const webpackConfig = {
...withModuleFederationPlugin({
remotes,
shared: share({
'@angular/core': {
singleton: true,
strictVersion: true,
requiredVersion: 'auto',
eager: true,
},
'@angular/common': {
singleton: true,
strictVersion: true,
requiredVersion: 'auto',
eager: true,
},
...sharedMappings.getDescriptors(),
}),
}),
};
const plugins = webpackConfig.plugins.filter((plugin) => !(plugin instanceof ModifyEntryPlugin));
// // Uncomment for debugging.
// console.log('webpackConfig:::', webpackConfig);
// console.log('plugins:::', plugins);
module.exports = {
...webpackConfig,
plugins,
}; I hope this helps. |
also just spent some time with this error after running into it during the update of a project to Angular 15. Part of the cause seems to be how the The issue of For the change to polyfills pointed out by @kaplan81 it's basically the same story, when run at the right lifecycle stage the changes should be possible to apply again. Looking at the Created a working patch with my colleague which fixes the functionality of the |
@manfredsteyer any idea if/when this could be reviewed and merged? got the patch running locally, but having to keep copies of it in several projects becomes cumbersome ;-) let me know if we can assist or speedup the process somehow, would be great to see a new release with some of the recent contributions which currently only exist as PRs. |
Sorry to bump this, but we are facing the same problem.
Unfortunately for us, removing Is there any chance this will be addressed? |
Sorry, I have to bring up this issue again. Some shared libs have With the fix provided in #278, everything works perfectly, and our chunk files return to their normal size. Hope that this issue will be addressed soon. |
Bump this ^, we are also facing the same issue on angular 15. can we merge this fix #273 soon? Thanks! |
Adding a friendly bump to this as well. Our CI/CD pipeline failed due to increased bundle size of |
eagerly (ha..ha..) waiting for the fix. |
I've also encountered this while investigating Module Federation for usage within our codebase, any chance that #278 could get progressed? Any timescale on when this could be merged? |
Ditto on the merge. @manfredsteyer can we get a 15.0.4 build please? |
On more "please" from us... |
And the same, end up on this very issue halfway through the upgrade. Is it fixed for 16? (not that I can upgrade it yet - too many libraries are broken because of ViewEngine removal). |
Eagerly waiting for PR. merge.... |
Hi all, |
Like suggested here #418 |
We get the following error message after updating to Angular 15
@angular-architects/module-federation version is 15.0.2
I was also able to reproduce that error message in the tutorial project with the following steps:
ng update
ng add @angular-architects/module-federation
to shell and remoteeager: true
to shareAll configuration in shell projectng serve shell
The error only occurs when eager is set to true in shareAll configuration
webpack.config.js shell
The text was updated successfully, but these errors were encountered: