You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 serverif(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)
The text was updated successfully, but these errors were encountered:
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:
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.
The text was updated successfully, but these errors were encountered: