ctrlplusb / react-async-component

Resolve components asynchronously, with support for code splitting and advanced server side rendering use cases.
MIT License
1.45k stars 62 forks source link

IE11 and Edge has error: Parsing error: Unexpected token import #47

Closed luojinghui closed 6 years ago

luojinghui commented 7 years ago

AsyncLogin.js

import { asyncComponent } from 'react-async-component';

export default asyncComponent({
  resolve: () => import('./index')
});

Use this plug-in for asynchronous loading components, other browsers can run, but in IE10 + all the browsers are reported on this error, do not know why, when the package using the babel compiler. how to solution? thanks

luojinghui commented 7 years ago

@threepointone @birkir @timsuchanek @tadeegan @ctrlplusb help me, thanks

birkir commented 7 years ago

Did you add a polyfill.io for browsers?

ctrlplusb commented 7 years ago

What workflow are you using? Babel & Webpack? You need to transpile import statements in order to run the code in the browser.

See babel-plugin-transform-imports

gurnzbot commented 6 years ago

Can you expand on that answer at all? I'm also having an issue with the `import('./someComponent') statement when server via SSR.