This works
import Component from '../component.jsx';
Throws error
import Component from '/client/modules/account_details/components/component.jsx';
Module not found: Error: Cannot resolve 'file' or 'directory'
Some of my components have absolute paths in the import statement, and this breaks the story too. Is there a workaround other than doing ../../../../
etc?
I tried using https://github.com/mantrajs/babel-root-slash-import but began getting the
Uncaught SyntaxError: Unexpected token import
issue after adding that package and .babelrc
file with
{
"plugins": [
"babel-root-slash-import"
]
}
was able to resolve this with
{
"presets": ["es2015", "react"],
"plugins": [
"babel-root-slash-import"
]
}
{
"presets": ["es2015", "react"],
"plugins": [
[
"babel-root-slash-import", {
"rootPathSuffix": "src/"
}
]
]
}
something like this?
for this doesn't work
also this is override the default configuration of .babelrc from create react app?