Closed krnlde closed 7 years ago
Acorn won't parse it by default. The way we fixed this in Rollup was to add an acorn
option where you could pass through the appropriate options:
const {code, map} = butternut.squash(source, {
acorn: {
allowReserved: true
}
});
Might be tricky to do via the CLI though...
Mhm. Maybe it is better to inject this by default through butternut? What would be the downsides?
I was wondering the same. I feel like there must be a reason that Acorn disables it by default, but I'm having a hard time understanding what the dangers are. I guess we could do that, and revisit it if it causes any weird bugs for people
The dangers would be that all "future reserved keywords" are valid. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Future_reserved_keywords
I don't know what the implications are though.
I think that the worst case is that it would preserve any existing bugs in the code, it wouldn't ever introduce new ones (since the mangler avoids reserved words)
Sounds like a reasonable change.
Run this specimen through https://butternut.now.sh/?version=0.4.1
Both await occurrences are perfectly valid and parsed correctly by Chrome (V8), butternut refuses to minify this.
This code is (essentially) used by the AsyncGenerator babel transform plugin.