Open avlonder opened 3 years ago
This would be really helpful and would save me from having to rename all my references in my code. For others looking for temporary solution, you could try this:
const {resolvePath} = require('babel-plugin-module-resolver');
module.exports = function (api) {
return {
plugins: [['module-resolver', {
alias: {...},
resolvePath(sourcePath, currentFile, opts) {
if (currentFile.indexOf(/node_modules/) > -1) {
return undefined;
}
return resolvePath(sourcePath, currentFile, opts);
}
}]]
};
};
How do I avoid applying the path mapping to the files inside node_modules? If, by coincidence, you pick an alias that resembles one of the imports used inside a third-party package, this can lead to unexpected behavior. I would like to constrain the path mapping only to the files inside src.