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

Error when trying to expose a module with Module Federation #429

Closed
mlshv opened this issue Jun 18, 2021 · 1 comment · Fixed by #434
Closed

Error when trying to expose a module with Module Federation #429

mlshv opened this issue Jun 18, 2021 · 1 comment · Fixed by #434

Comments

@mlshv
Copy link

mlshv commented Jun 18, 2021

Hi! I'm trying to make the plugin work with WP5 Module Federation but I get the following error:

「wdm」: TypeError: Cannot read property 'includes' of undefined
    at /Users/mmmm/code/mfe-material/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/index.js:105:27
    at Array.findIndex (<anonymous>)
    at /Users/mmmm/code/mfe-material/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/index.js:104:50
    at Hook.eval [as callAsync] (eval at create (/Users/mmmm/code/mfe-material/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:97:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mmmm/code/mfe-material/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/mmmm/code/mfe-material/node_modules/webpack/lib/Compiler.js:1081:20
    at Hook.eval [as callAsync] (eval at create (/Users/mmmm/code/mfe-material/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mmmm/code/mfe-material/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.compile (/Users/mmmm/code/mfe-material/node_modules/webpack/lib/Compiler.js:1071:28)
    at /Users/mmmm/code/mfe-material/node_modules/webpack/lib/Watching.js:188:19

I've created a repo with reproduction: https://github.com/mlshv/mfe-react-refresh-bug

The error goes away when I comment exposed module:

// webpack.config.js

plugins: [
    new ModuleFederationPlugin({
        name: '_main',
        filename: 'remoteEntry.js',
        exposes: {
            './App': './src/App.js', // comment this line to make the error go away
        },
    }),
    new HtmlWebpackPlugin({
        template: 'src/index.html',
    }),
    new ReactRefreshWebpackPlugin(),
],
@nctay
Copy link

nctay commented Jun 23, 2021

Same error.
@pmmmwh, is there anything you can do?

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

Successfully merging a pull request may close this issue.

2 participants