-
Notifications
You must be signed in to change notification settings - Fork 252
After upgrade to json5@2, rollup bundle fails #182
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
Comments
json5@2.0.0 no longer targets ES5, and instead it targets Node.js v6 or greater. Moving forward, new major versions of json5 will target the oldest LTS version of Node.js at the time of publishing. If you're using Node.js v6+, then you probably shouldn't be using rollup-plugin-uglify (or uglify-js) since it doesn't support ES6+. I recommend switching from rollup-plugin-uglify to rollup-plugin-terser, which does support ES6+. If you're using Node.js v5 or lower, then you should stick with json5@1.0.1. Alternatively, if you want to use json5@2 and rollup-plugin-uglify, you can use the bundle at import JSON5 from 'json5/dist/index'
console.info(JSON5.stringify('aa')) |
I just tried to import from 'json5/dist/index', it still not target ES5, so not work in browser environment. |
Oh, sorry. You're right. The bundle at |
Actually, I just realized that rollup-plugin-terser doesn't output ES5 by default either. So json5@2.0.0 has no support for ES5. I'll get that fixed in 2.0.1. |
Fixed in v2.0.1. |
demo index.js
demo rollup.config.js
rollup --config rollup.config.js
error message
It seems uglify-js is able to transpile only es5 syntax, and I'm using json5 in browser environment and target es5.
I'm not sure this is json5's bug(for example if json5 does not target es5 anymore, it is not a bug), feel free to close if not.
The text was updated successfully, but these errors were encountered: