-
Notifications
You must be signed in to change notification settings - Fork 267
Closed
Labels
Description
demo index.js
import JSON5 from 'json5'
console.info(JSON5.stringify('aa'))demo rollup.config.js
import { uglify } from 'rollup-plugin-uglify'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
export default {
input: 'index.js',
name: 'Test',
plugins: [
resolve(),
uglify(),
commonjs()
],
output: {
file: 'index.min.js',
format: 'umd'
}
}rollup --config rollup.config.js
error message
index.js → index.min.js...
17 |
18 | var util = {
> 19 | isSpaceSeparator (c) {
| ^ Unexpected token: punc (()
20 | return unicode.Space_Separator.test(c)
21 | },
22 |
[!] (uglify plugin) Error: Error transforming bundle with 'uglify' plugin: Unexpected token: punc (()
Error: Error transforming bundle with 'uglify' plugin: Unexpected token: punc (()
at error (/Users/yaoyao/.config/yarn/global/node_modules/rollup/dist/rollup.js:3365:15)
at /Users/yaoyao/.config/yarn/global/node_modules/rollup/dist/rollup.js:13868:17
at <anonymous>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.