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

Could not import waterfall from async-es/waterfall (ES6 syntax) #1351

Closed
tiendq opened this issue Jan 17, 2017 · 5 comments
Closed

Could not import waterfall from async-es/waterfall (ES6 syntax) #1351

tiendq opened this issue Jan 17, 2017 · 5 comments
Labels

Comments

@tiendq
Copy link

tiendq commented Jan 17, 2017

What version of async are you using?
2.1.4

Which environment did the issue occur in (Node version/browser version)
7.4.0, Chrome 55

What did you do? Please include a minimal reproducable case illustrating issue.
Using waterfall in a module with ES6 syntax, my module is transpiled well with babel/webpack.

import waterfall from 'async-es/waterfall';

What did you expect to happen?
No error.

babel-loader needs only to handle my code, not modules in node_modules folder.

What was the actual result?
Chrome reports following error at line 2 in waterfall.js:

Uncaught SyntaxError: Unexpected token import

import isArray from 'lodash-es/isArray';
@megawac
Copy link
Collaborator

megawac commented Jan 17, 2017

You have to add async-es and lodash-es to the list of modules to be transpiled (babel/babel-loader#171 (comment)) as these modules use some ES2015 syntax. You can also use the standard async package which doesn't require transpilation.

@tiendq
Copy link
Author

tiendq commented Jan 18, 2017

@megawac

exclude: /node_modules\/(?![async\-es|lodash\-es])/ works for me.

I wish this tip is included in the async ES6 version instruction since excluding node_modules is likely default babel-loader configuration.

Thanks,

@megawac
Copy link
Collaborator

megawac commented Jan 18, 2017

@aearly ^ thoughts

@aearly
Copy link
Collaborator

aearly commented Jan 18, 2017

Does the babel-loader respect the esnext:main prop (or something similar) in the package.json? If so, we should add it.

Otherwise, it's definitely worth a line in the readme.

@AndersDJohnson
Copy link

@tiendq @megawac @aearly I've created a webpack helper to automatically detect dependencies such as this one that may require Babel transpilation. See https://github.com/andersdjohnson/webpack-babel-env-deps.

For it to work in its current form, this module would have to indicate engines in its package.json with the minimum Node version that supports any features required by its async-es build. FYI @caolan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants