twilio-professional-services/flex-project-template

Unexpected token: punc (.) when deploying with luxon 3.4.4

Closed this issue · 1 comments

Hi,

I'm having this error when trying to deploy:

> plugin-flex-ts-template-v2@9.0.54 deploy
> twilio flex:plugins:deploy --changelog=Deploy from CI/CD for commit d88f7cdf3ae3806c177b44e305a11d09b5e5b655

 ›   Warning: twilio-cli update available from 5.5.0 to 5.18.0. For more 
 ›   information: https://twil.io/cli 
Using profile ${TWILIOAPIKEY}/${TWILIOAPISECRET} (***)

- Validating deployment of plugin plugin-flex-ts-template-v2
✔ Validating deployment of plugin plugin-flex-ts-template-v2
- Compiling a production build of plugin-flex-ts-template-v2
(node:2045) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:2045) [DEP_WEBPACK_COMPILATION_CACHE] DeprecationWarning: Compilation.cache was removed in favor of Compilation.getCache()


Failed to compile plugin plugin-flex-ts-template-v2.

Error 1:
plugin-flex-ts-template-v2.js from Terser
Unexpected token: punc (.) [plugin-flex-ts-template-v2.js:66293,13]
    at ne (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:19592)
    at c (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:28298)
    at l (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:28389)
    at f (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:28442)
    at U (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:42256)
    at me (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:48326)
    at /home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:49206
    at ve (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:49221)
    at ke (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:50475)
    at We (/home/runner/.twilio-cli/nodemodules/terser-webpack-plugin/nodemodules/terser/dist/bundle.min.js:1:50707)

Error: Process completed with exit code 1.

Disabling minification, I was able to identify that on the cited line of the bundle (66293) the lib luxon uses an optional chaining (?.) which is probably breaking the build. I was also able to notice that luxon introduced this optional chaining on version 3.4.4. If I downgrade luxon to 3.4.3, the deploy works.

Hi @fmilani! This is a bug that was resolved in the Flex plugins CLI version 6.3.1. To update the CI scripts to use that version, you may edit the install-flex-plugin script in plugin-flex-ts-template-v2/package.json to install version 6.3.1. We'll be merging #494 shortly which contains this fix.