magesuite / magepack

Next generation Magento 2 advanced JavaScript bundler.
Open Software License 3.0
438 stars 91 forks source link

Terser Minify-Error: Unexpected token: punc (.) #155

Closed p24-max closed 2 years ago

p24-max commented 2 years ago

The command magepack bundle --minify -d fails with the following error:

[...]
Loading "Magento_PageBuilder/js/content-type/banner/appearance/default/widget" from "pub/static/frontend/Babyonline/theme/de_DE/Magento_PageBuilder/js/content-type/banner/appearance/default/widget.js".
› Bundle "category" collected.                                                                                                                              17:29:06
› Minifying "category" bundle.                                                                                                                              17:29:06

 ERROR  Unexpected token: punc (.)                                                                                                                          17:29:06

  at ne (node_modules/terser/dist/bundle.min.js:1:19592)
  at c (node_modules/terser/dist/bundle.min.js:1:28298)
  at l (node_modules/terser/dist/bundle.min.js:1:28389)
  at f (node_modules/terser/dist/bundle.min.js:1:28442)
  at U (node_modules/terser/dist/bundle.min.js:1:42256)
  at me (node_modules/terser/dist/bundle.min.js:1:48326)
  at node_modules/terser/dist/bundle.min.js:1:49206
  at ve (node_modules/terser/dist/bundle.min.js:1:49221)
  at ke (node_modules/terser/dist/bundle.min.js:1:50475)
  at We (node_modules/terser/dist/bundle.min.js:1:50707)

When I execute the command without --minify option, it works well. Any idea how to fix this?

dejanangelevski commented 2 years ago

i have the same issue, any solution?

musabatas commented 2 years ago

Same here.

DinkoIlicic commented 2 years ago

The issue should be tied to https://www.javascripttutorial.net/es-next/javascript-optional-chaining-operator/ if some new module uses the new javascript feature, the magepack does not properly read it.

This should be fixed by updating the terser package to the newest version which is done here: https://github.com/magesuite/magepack/commit/b96eeccd3605d6fcfac8d4cc26445c3b0072990f This is merged into the master branch but no release yet for it for us to use.

jakegore commented 2 years ago

Do we know when b96eeccd3605d6fcfac8d4cc26445c3b0072990f is going to be in a release? @krzksz

sanganinamrata commented 2 years ago

@krzksz May I know when the fixes of this issue will get released? We're facing that issue on our live websites, and need to disable bundling due to that. The solution needed urgently.

akshayshakya94 commented 2 years ago

I'm also facing same issue. please help

hammockvienna commented 2 years ago

same here... would be great if there is a new release ...

krzksz commented 2 years ago

Fixed by https://github.com/magesuite/magepack/commit/c0ff0fca5323aef626ecc4d4281f84178fa5d752