Reputation: 105
I've got an old project on my hands which uses cortex and gulp to construct the code.
Cortex is a package tool, kind of like npm, but it puts the packages under its own directory called neurons, not node_modules. As the code scales and becomes larger, I want to use webpack's hot loader in the dev environment. But when I run webpack, require can't find packages that are installed by cortex because it always tries to locate them in the node_modules folder instead of the neurons folder.
(The packages are very old, I can't even find them in the npm, which means I have to use cortex's packages)
Is there any way to make the require function read different paths?
Upvotes: 1
Views: 55
Reputation: 1209
Yes, you can set it in your webpack.config.js
like this:
resolve: {
modules: [
path.resolve('./neurons'),
'node_modules'
]
}
The modules option defaults to: modules: ["node_modules"]
, so that's why it can't find your cortex packages.
Upvotes: 1