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

reduxThunkErrorHandler.cjs.js is not ES5 #8

Closed
mst-avaleo opened this issue Aug 8, 2019 · 2 comments
Closed

reduxThunkErrorHandler.cjs.js is not ES5 #8

mst-avaleo opened this issue Aug 8, 2019 · 2 comments

Comments

@mst-avaleo
Copy link

It seems that commonjs bundles for redux-thunk-error-handler (and for redux-thunk-recursion-detect) are not compatible with ES5. They are using const keyword.

λ es-check es5 reduxThunkErrorHandler.cjs.js 
ES-Check: there were 1 ES version matching errors.

          ES-Check Error:
          ----
          · erroring file: reduxThunkErrorHandler.cjs.js
          · error: SyntaxError: The keyword 'const' is reserved (7:0)

Is that on purpose?

@mst-avaleo
Copy link
Author

By default we don't transpile node_modules dependencies. We assume that they are in ES5. Lucky default webpack uglify plugin understands only ES5, therefore we found the problem quite quickly.

Of course we can include those packages in babel-loader processing. The annoying part is that we want to use those packages in library which is used few applications, therefore each application needs to change their build scripts.

@itaylor
Copy link
Owner

itaylor commented Aug 10, 2019

Yes, that is true, the libraries published here are all using ES6. We do use babel in the build process, but I think we're only using a single babel plugin, for object-rest-spread, because that support is still not available in the latest version of Edge. All other modern browsers support all the syntax used here.

The commonjs compiled versions are ES6 with commonjs require instead of ES6 Modules and the import statement.

Unless you're trying to support some very old browsers, and need to compile to ES5, I'd recommend switching your webpack build from uglify to terser. It's more compatible with new language constructs and runs faster as well. Newer versions of webpack switched by default.

webpack-contrib/terser-webpack-plugin#15
https://twitter.com/wsokra/status/1064441984532848641?lang=en

@itaylor itaylor closed this as completed Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants