app-module-path-node
app-module-path-node copied to clipboard
app-module-path not working with webpack?
I am using webpack to transpile my build. Seems to me app-module-path doesn't work when using webpack for builds?
FYI, not using app-module-path, you can of course resolve via Webpack config:
resolve: { modulesDirectories: [ 'src', 'node_modules' ], extensions: ['', '.js', '.jsx'] },
It just would be nice to have a catch all solution.
Sounds like Webpack chose to use its own module resolving logic instead of using the the logic that Node.js provides internally. I don't think that was a good decision, but if you have any thoughts on how we can accommodate Webpack please share.
Webpack has this functionality built-in. There's a "resolve" section in their docs. You just have to configure webpack with the same base dir that you used in your .addPath(baseDir)
// in webpack.config.js
{
...
resolve: {
alias: {
client: myClientBaseDir,
server: myServerBaseDir,
...etc
}
},
...
}