Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested 'import' with code splitting support #751

Closed
hanford opened this issue Jan 19, 2017 · 2 comments

Comments

@hanford
Copy link

commented Jan 19, 2017

In my code for code-splitting, I'm getting:

index.js:156:9: Parsing error: 'import' and 'export' may only appear at the top level

However, according to the webpack2 guides and the proposed ES6 modules spec, import can in fact be nested.

https://webpack.js.org/guides/migrating/#code-splitting-with-es2015

@feross

This comment has been minimized.

Copy link
Member

commented Jan 19, 2017

It looks like import() is still in stage 3 of the standardization process. ESLint has a policy of only implementing features in their parser once they're in stage 4.

So, standard will support this eventually, but not until the spec is stable.

You can try installing this babel plugin (https://babeljs.io/docs/plugins/syntax-dynamic-import/) and tell standard to use Babel as it's parser if you want to be on the bleeding edge. To do that:

npm install babel-eslint
standard --parser babel-eslint

@feross feross closed this Jan 19, 2017

@hanford

This comment has been minimized.

Copy link
Author

commented Jan 19, 2017

Thanks for the speedy response!

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.