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

Unexpected token: keyword «const» #78

Open
lhtdesignde opened this issue Jul 4, 2019 · 4 comments
Open

Unexpected token: keyword «const» #78

lhtdesignde opened this issue Jul 4, 2019 · 4 comments

Comments

@lhtdesignde
Copy link

lhtdesignde commented Jul 4, 2019

Hi,
I just updated to 2.1.2. It all works great and I can check now against all countries. Unfortunately a problem with the production build happened. We use webpack and babel to build. We run our code through babel but not the vendor files so everything es6 related breaks browsers that can't handle es6.
Would it be possible to avoid using es6 features? This error happened when UglifyJs tried to do it's thing. Here the error:

ERROR in 22-chunk.js from UglifyJs Unexpected token: keyword «const» [./node_modules/jsvat/lib/es6/lib/countries/austria.js:1,7]

@se-panfilov
Copy link
Owner

@lhtdesignde Hi, firt of all thank you for using jsvat.

Hm, I'm not sure about this one, honestly...

The thing is that I wanted to drop support of everything below es6.

In fact I'm already generate 5 versions of library for each modules systems: amd, commonjs, es6, system, umd .

So there will be only two options:

  • Generate 10 versions like amd.es6, amd.es3, commonjs.es6, commonjs.es3, etc...;
  • Or generate only es3-versions, what can be a bit extra for those who already accept es6-based vendors files;

Honestly, I think I have to take some timeout and make an experiment to see how much things will be changed if I'll generate es3-compatible versions

@lhtdesignde
Copy link
Author

lhtdesignde commented Jul 30, 2019

Absolutely understandable! I'm hesitant to run all vendor packages through babel though. I think it would cause too many side effects. But we might have to re-evaluate if we need to ship es5 anyway still. Thanks for taking a look!

@se-panfilov
Copy link
Owner

se-panfilov commented Oct 21, 2019

As a temporary solution, commonjs is now (v2.1.4) target es5, it might helps

@lhtdesignde
Copy link
Author

lhtdesignde commented Nov 1, 2019

ya it helped and also I actually switched from Uglify to Terser since uglify can't do es6! Feel free to close this. :) And thanks again!

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

No branches or pull requests

2 participants