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

Module Federation support like Angular/React with Nx natively? #256

Open
codef0rmerz opened this issue Jun 2, 2022 · 3 comments
Open

Module Federation support like Angular/React with Nx natively? #256

codef0rmerz opened this issue Jun 2, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@codef0rmerz
Copy link

codef0rmerz commented Jun 2, 2022

Is there any example/documentation available to enable module federation in the generated vue3 application?

I've tried to do this but getting an error Cannot read property 'includes' of undefined

const { ModuleFederationPlugin } = require('webpack').container;

module.exports = (config) => {
  config.plugins.push(
    new ModuleFederationPlugin({
      name: 'profileSettings',
      filename: 'remoteEntry.js',
      exposes: {
        './HelloWorld': './src/components/HelloWorld',
      },
    })
  );
};

I further debugged the issue and found out that it's because of missing output.enabledLibraryTypes property in config. But when I tried to setup an empty array against enabledLibraryTypes property in output, it yells with invalid schema warning.

Cannot read property 'includes' of undefined
TypeError: Cannot read property 'includes' of undefined
    at ModuleFederationPlugin.apply (/node_modules/webpack/lib/container/ModuleFederationPlugin.js:52:49)
    ```
@codef0rmerz codef0rmerz added the enhancement New feature or request label Jun 2, 2022
@ZachJW34
Copy link
Owner

ZachJW34 commented Jul 4, 2022

Is there a recommended example of setting up Module Federation with a vue-cli application? I'm not too familiar with module federation but if you share a repo that exhibits your webpack changes not being respected I can help debug

@codef0rmerz
Copy link
Author

Thanks @ZachJW34 for helping. You can check https://github.com/module-federation/module-federation-examples/tree/master/vue3-cli-demo example and try to plug in the MF configurations in configure-webpack.js of the generated app via nx-plus.

@ZachJW34
Copy link
Owner

ZachJW34 commented Jul 4, 2022

I see that the demo is using vue-cli v5, which uses Webpack 5. I plan on getting to the upgrade soon which should help #228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants