Babel-eslint does not allow dynamic imports
I am using webpack 2 and I want to do dynamic imports. Linter gives the following error when importing dynamically (i.e. import(...)
):
[js] Request or expression pending. (JSX attribute) import: true.
I have the following .eslintrc
(excerpt):
{
"parser": "babel-eslint",
"parserOptions": {
"allowImportExportEverywhere": true
}
}
The following is installed:
"eslint": "^3.16.1",
"babel-eslint": "^7.2.3",
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
Babelrc config:
{
"presets": [
"es2015",
"react"
],
"plugins": ["syntax-dynamic-import", "dynamic-import-webpack"]
}
Update: An example where the error occurs (app responsive). (The error here is simple [js] Declaration or statement expected
):
const App = () => {
import('./routes/Main/Main').then((Main) => {});
return(<div />);
};
+3
source to share