How to config additional paths for Babel to compile #13532
-
Hi, I have a custom component library in the node_modules folder (or in .yalc), which I would like to compile together with the nextjs app. I am using Yalc, to work with yarn/npm packages locally.
Without configuration it appears that the libraries' components (located in .yalc/my-module/src) can't find imported components (such as React, or a sibling component in the same library). Now I would need to do a custom-webpack-config in next.config.js ? Do I need to modify defaultLoaders.babel directly or add a plugin ? I would appreciate any input on how to accomplish that. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
// next.config.js
const withTM = require("next-transpile-modules")(["my-module", "my-module-2"]);
module.exports = withTM(); |
Beta Was this translation helpful? Give feedback.
next-transpile-modules
is the go-to module for adding this behavior: