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

[5.0.0] NamedModulesPlugin is not a constructor #11637

Closed
sergeushenecz opened this issue Oct 11, 2020 · 5 comments
Closed

[5.0.0] NamedModulesPlugin is not a constructor #11637

sergeushenecz opened this issue Oct 11, 2020 · 5 comments

Comments

@sergeushenecz
Copy link

sergeushenecz commented Oct 11, 2020

Hello everyone. After update to 5.0 I have problem when i start app.
TypeError: webpack.NamedModulesPlugin is not a constructor

plugins: options.plugins.concat([
        // It is needed to provide a workaround for moment js working with webpack.
        new webpack.ContextReplacementPlugin(/^\.\/locale$/, context => {
            if (!/\/moment\//.test(context.context)) {
                return;
            }
            // context needs to be modified in place
            Object.assign(context, {
                // include only ru and en variants
                // all tests are prefixed with './' so this must be part of the regExp
                // the default regExp includes everything; /^$/ could be used to include nothing
                regExp: /^\.\/(en|ru|pl)/,
                // point to the locale data folder relative to moment's src/lib/locale
                request: '../locale',
            });
        }),
        new webpack.DefinePlugin(StringifiedEnvVars),
        new webpack.NamedModulesPlugin(),
    ]),
@jouni-kantola
Copy link

NamedModulesPlugin ↦ optimization.moduleIds: 'named'

https://webpack.js.org/migrate/5/#update-outdated-options

@sergeushenecz
Copy link
Author

@jouni-kantola thanks

@alexander-akait
Copy link
Member

This plugin was removed, you even don’t need this anymore, we use better logic for long term caching out of box

@omkar-asort
Copy link

Hey! I am still confused. What do we write in place of new webpack.NamedModulesPlugin()

@alexander-akait
Copy link
Member

Remove it, default values for v5 it the best solution

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

No branches or pull requests

4 participants