ember-cli-terser icon indicating copy to clipboard operation
ember-cli-terser copied to clipboard

v4.0.2 gives build error `Unexpected token: punc (:)`

Open kellyselden opened this issue 4 years ago • 7 comments

Updating to v4.0.2 gives us the following in our build logs:

error	08-Jul-2021 12:04:17	Error: Unexpected token: punc (:)
error	08-Jul-2021 12:04:17	        at TerserWriter
error	08-Jul-2021 12:04:17	-~- created here: -~-
error	08-Jul-2021 12:04:17	    at new Plugin (/node_modules/broccoli-terser-sourcemap/node_modules/broccoli-plugin/dist/index.js:47:36)

v4.0.1 is working. Are we missing a transitive dependency update? Or is there an issue with v4.0.2?

kellyselden avatar Jul 16 '21 22:07 kellyselden

I'm still facing this year old issue! is this package deprecated?

rami-alloush avatar Dec 01 '22 16:12 rami-alloush

@rami-alloush No, at the moment, it's not. @kellyselden Did you manage to figure out what was causing this?

bertdeblock avatar Feb 08 '23 20:02 bertdeblock

I have not.

kellyselden avatar Feb 08 '23 20:02 kellyselden

confirmed its still an issue with the recent changes. @bertdeblock its due to broccoli-asset-rev prepend, can help you track down why if needed. see also https://github.com/ember-cli/broccoli-terser-sourcemap/issues/310 and https://github.com/ember-cli/ember-cli-terser/issues/275 which are all the same regression I believe

runspired avatar Feb 14 '23 02:02 runspired

The code it chokes on is this:

const file = await fetch(<<CDN_RUL>>`/translations/en-us-0875d483587e8fe8b6c09c9f9f8008f6.json`);

note how that is outside of the backticks

this is the original source code:

const file = await fetch(`/translations/en-us.json`);

It would appear that potentially broccoli-asset-rev is not handling prepend correct when backticks are in use

runspired avatar Feb 14 '23 02:02 runspired

Actual issue I think: https://github.com/ember-cli/broccoli-asset-rev/issues/143

runspired avatar Feb 14 '23 02:02 runspired

https://github.com/ember-cli/ember-cli/issues/9528 seems like the same issue and https://github.com/ember-cli/broccoli-asset-rewrite/pull/73 was made as an attempt to fix it.

bertdeblock avatar Feb 14 '23 06:02 bertdeblock