I have folder in node_modules named: @mymodule and inside it there is a folder named 'insidefolder'
Path looks like this: node_modules/@mymodule/insidefolder
Using ES6 syntax I try to import insidefolder in this module:
import insidefolder from '@mymodule/insidefolder';
I get an error: Error: Cannot find module '../ymodule/insidefolder'
const mymodule = require('@mymodule/insidefolder');
Works just fine.
How can it be fixed?
It happens so that my .babelrc had plugin:
["babel-root-import", [{
"rootPathPrefix": "@",
"rootPathSuffix": "src"
}]]
And every import starting with @ pointed to src path. I deleted this and everything works just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With