Closed tommikaikkonen closed 7 years ago
Hello @tommikaikkonen, thank you very much for your PR! We're working very hard on the next version of mostjs over at @most/core
and this was a backport of a much needed improvement which over there is transpiled and it slipped past us here :smile:
@tommikaikkonen We just published 1.2.1, with your change. Sorry about that accidental let
, and thanks for the fix!
Sweet, thanks guys! 👍
Using Webpack 2 to compile an application using
most
, the minification step generates this error:The generated bundle would also fail in browsers that don't support ES6 because of the
let
keyword.Webpack 2 uses the value of the
module
key inpackage.json
to resolve themost
package with ES2015 modules, so it can apply tree shaking. Inmost
, this is just the plain source code inmost/src
.In the package
module
points to, all other statements thanimport
andexport
should be usable in the environmentsmost
wants to support. To support ES5, we need to usevar
instead oflet
here. This was the only use oflet
I found in the source code, other than a couple ones in the tests which doesn't matter for app bundle compilation.This pull request changes that one
let
tovar
.If you guys are planning to use more ES6 features in the codebase, a separate build is probably needed that transpiles to ES5 (or whatever
most
wants to support), but doesn't transpile theimport
andexport
statements so that bundlers can take advantage of tree shaking.