browserify / bundle-collapser

convert bundle paths to IDs to save bytes in browserify bundles
Other
194 stars 21 forks source link

Syntax Error with object spread #25

Open StephanHoyer opened 4 years ago

StephanHoyer commented 4 years ago

test.js

const a = { ...{ a: 1 } }

bundle command

browserify -p bundle-collapser/plugin test.js

output

SyntaxError: Unexpected token (1:12)
at Parser.pp$4.raise (./node_modules/acorn/dist/acorn.js:2840:15)
at Parser.pp.unexpected (/User./acorn/dist/acorn.js:689:10)
at Parser.pp$3.parseIdent (./node_modules/acorn/dist/acorn.js:2791:12)
at Parser.pp$3.parsePropertyName (./node_modules/acorn/dist/acorn.js:2597:107)
at Parser.pp$3.parseProperty (./node_modules/acorn/dist/acorn.js:2524:10)
at Parser.pp$3.parseObj (./node_modules/acorn/dist/acorn.js:2478:23)
at Parser.pp$3.parseExprAtom (./node_modules/acorn/dist/acorn.js:2239:19)
at Parser.pp$3.parseExprSubscripts (./node_modules/acorn/dist/acorn.js:2092:21)
at Parser.pp$3.parseMaybeUnary (./node_modules/acorn/dist/acorn.js:2069:19)
at Parser.pp$3.parseExprOps (./node_modules/acorn/dist/acorn.js:2013:21)

Browserify-Version: 16.5.1 Bundle-Collapser-Version: 1.4.0 Acorn-Version: 7.3.1

schaeferCode commented 2 months ago

I'm running into this same problem. Why was this issue closed? Is there a fix?

My bundle command: browserify -t babelify -t unassertify -t envify -p common-shakeify -p browser-pack-flat -p bundle-collapser/plugin v1/index.js | uglifyjs -cm >

Browserify-Version: 7.0.0 Bundle-Collapser-Version: 1.4.0 Acorn-Version: 7.4.1

As a side note, this only became an issue for me when upgrading babel/core from 7.22.9 to 7.25.2.