Is it possible to prevent babel
from translating import
to required
?
I'm currently learning Reactjs
and I'm using babel
to translate JSX
and ES6
to ES5
code.
However, babel
translates import
to required
, which was useable using nodejs
or requirejs
, which I both don't want to use in this case.
Yes, you can configure Babel to leave import and export statements unchanged by using the @babel/preset-env preset with the modules: false option. This will tell Babel not to change the import and export statements.
{
"presets": [
["@babel/preset-env", {
"modules": false
}]
]
}