I have a React component library that is used in a React app. The component library is setup using Styleguidist and webpack. I've setup webpack to use absolute paths using:
webpackConfig: {
resolve: {
modules: [path.resolve(__dirname, 'src/'), 'node_modules'],
}
}
This works within the context of the component library. When I build
the component library, the package looks like this:
/core
/components
/Table
/Row
When I import
the components into my app, I get an error:
Module not found: Can't resolve components/Row in /Users/myusername/Sites/mysite/node_modules/@mypackage/core/components/Table
I understand why the paths don't match in the context of node_modules
, but I would've expected Webpack to transform those import paths during the build process. Is there something I'm missing? Or is this not possible?