Add support for ES6 features #532

Closed
jampy opened this Issue Oct 13, 2014 · 14 comments

Projects

None yet
@jampy
jampy commented Oct 13, 2014

Currently webpack seems to fail parsing JavaScript code that contains ES6 syntax like generators.

Module parse failed: ..../main.js Line 20: Unexpected token *
You may need an appropriate loader to handle this file type.
| }
| 
| function * ex_test() {
|   throw new Error("work!");
| }

Could you please adjust the static code analysis so that it doesn't break with code that uses generators?

I'm trying to use generators natively in browsers that support them, so don't want to use a transpiler in this case..

@sokra sokra added the enhancement label Oct 13, 2014
@sokra
Member
sokra commented Oct 13, 2014

We can do this once esprima 2.0 is published...

@andreypopp
Contributor

esprima-fb package can be used instead as it provides es6 features and is robust (used by Facebook for JSX toolchain).

@syranide
Contributor

@andreypopp Aren't all the non-JSX features of esprima-fb part of the esprima harmony branch?

@sokra
Member
sokra commented Jan 12, 2015
@pornel
pornel commented Mar 26, 2015

👍 I'd like to use ES6 output too.

Esprima 2 is now available and Webpack tests pass with 2.1.0.

@sokra
Member
sokra commented Mar 26, 2015

This should work in the webpack-2 branch

@jhnns
Member
jhnns commented Mar 27, 2015

@pornel webpack-2 is using acorn.

@Sinewyk
Sinewyk commented Apr 19, 2015

Any news on this ? Is there a way to hack it to let webpack just pass through es6 code, and let the developer the responsibility to send supported code to wherever ?

@remimarenco

👍

@dbrans
dbrans commented Jul 1, 2015

Hi, has anyone found a solution/workaround?
Cheers

@sokra
Member
sokra commented Jul 1, 2015

You can use the webpack-2 branch. It is using a ES6 parser (acorn) and understands import export and System.import.

@ariya
ariya commented Aug 2, 2015

@sokra I experimented with bumping the dependencies (package.json) to Esprima 2.5, ran npm test and so far nothing breaks the tests. This is the easiest to allow webpack to consume ES6 code.
Is this something that is desireable? If yes, I can create a PR.

@sokra
Member
sokra commented Aug 10, 2015

@sokra I experimented with bumping the dependencies (package.json) to Esprima 2.5, ran npm test and so far nothing breaks the tests. This is the easiest to allow webpack to consume ES6 code.
Is this something that is desireable? If yes, I can create a PR.

I've bumped it for 1.12... Let's see how this works out.

@XeCycle
XeCycle commented Aug 26, 2015

1.12 is working for my project (babel blacklist regenerator), and tests passed, though very low coverage. Maybe this can be closed, if no need for further confirmations.

@sokra sokra closed this Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment