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

Webpack alias for installed modules not working #3439

Closed
steffans opened this issue Jun 13, 2018 · 3 comments
Closed

Webpack alias for installed modules not working #3439

steffans opened this issue Jun 13, 2018 · 3 comments
Assignees

Comments

@steffans
Copy link

What problem does this feature solve?

Currently its not possible to alias a installed node module in a SSR build. This is not working because all installed modules are externals using the webpack-node-externals function (see /nuxt-edge/lib/builder/webpack/server.js line 60).

To make it work you currently have to clear the externals and a add an alias like this:

        extend(config, {isServer}) {

            // Alias module on server
            if (isServer) {
                config.externals = [];
                config.resolve.alias['my-modules'] = 'path/to/alias.js';
            }

        }

Aliasing is useful for example to include a different implementation or a empty module for SSR, specially when a existing module is not SSR compatible.

What does the proposed changes look like?

Maybe a the webpack-node-externals "whitelist" option could be exposed through a nuxt config setting, which would allow to whitelist modules which then can be aliased using webpack.

This feature request is available on Nuxt community (#c7241)
@ghost ghost added the cmty:feature-request label Jun 13, 2018
@manniL
Copy link
Member

manniL commented Aug 19, 2018

@steffans I'd be happy to see a PR for this ☺️

@galvez galvez self-assigned this Aug 26, 2018
@galvez
Copy link

galvez commented Aug 26, 2018

@clarkdo do you see any problems in offering this?

If not, please reopen and I'll add to my experimentation queue.

@galvez galvez closed this as completed Aug 26, 2018
@lock
Copy link

lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants