jsvat
jsvat copied to clipboard
Unexpected token: keyword «const»
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]
@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
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!
As a temporary solution, commonjs
is now (v2.1.4) target es5, it might helps
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!