Seems like dynamic imports should work since https://github.com/facebook/flow/pull/3544.
So I must be doing something wrong in my first dynamic import here:
// @flow
import Loadable from 'react-loadable'
import LoadingComponent from './LoadingComponent'
const AsyncActors = Loadable({
loader: () => import('./Actors'),
loading: LoadingComponent,
})
export default AsyncActors
This code provokes "unexpected token import" on the import statement.
I am using flow-bin v0.49.1.
This still happens with flow-bin v0.53.1
I use babel-plugin-dynamic-import-node for jest babel config and babel-plugin-syntax-dynamic-import for webpack. That helps.
Thanks. But I don't want to eject from create-react-app.
I'm getting the same issue with dynamic imports, despite using the babel plugins. Is this being looked into?
@joaquindk Is the problem with flow or babel?
Definitely flow @TrySound
The latest version does not show unexpected token
https://flow.org/try/#0PTAEAEDMBsHsHcBQiCWBbADrATgFwBQDkAdMAM6xoCmuAFigHYDmhAlEA
Nice! Thanks @TrySound
This probably can be closed.
/cc @vkurchatkin
Most helpful comment
I use
babel-plugin-dynamic-import-nodefor jest babel config andbabel-plugin-syntax-dynamic-importfor webpack. That helps.