-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
[WIP] Support custom regex for excluding modules from Webpack loaders #3470
Conversation
This allows the user to specify a custom regular expression to exclude modules from being handled by JS webpack loaders. The regex can be customized to exclude certain dependencies if transpiling is needed for those modules. (Fixes vercel#706)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks exactly like what I need for my use case as well
Really nice - and just through exposing an existing API which is currently widely used. |
@@ -1056,6 +1056,26 @@ module.exports = { | |||
|
|||
Note: Next.js will automatically use that prefix in the scripts it loads, but this has no effect whatsoever on `/static`. If you want to serve those assets over the CDN, you'll have to introduce the prefix yourself. One way of introducing a prefix that works inside your components and varies by environment is documented [in this example](https://github.com/zeit/next.js/tree/master/examples/with-universal-configuration). | |||
|
|||
### Transpile NPM modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is just exposing the webpack
API would the documentation make more sense to say that, and use this as an example of how you might do it?
We're going to add support for transpiling node_modules after v5 is shipped. |
This allows the user to specify a custom regular expression to exclude modules from being handled by JS webpack loaders. The regex can be customized to include certain dependencies if transpiling is needed for those modules. (Possible fix for #706)
Example next.config.js (enables transpiling for files within
node_modules/my-module
):