twilio-video.js icon indicating copy to clipboard operation
twilio-video.js copied to clipboard

Fails to compile with webpack: The keyword 'import' is reserved

Open gburt opened this issue 3 years ago • 1 comments
trafficstars

Since this change merged our webpack build of our repo using twilio-video is failing to build with the following error, so we're unable to upgrade to 2.23.0

Error: Error: [static/js/2085.1c3eda7d.chunk.js]:The keyword 'import' is reserved (2:23360)

gburt avatar Aug 12 '22 16:08 gburt

More context: We use ecma-version-validator-webpack-plugin to pin our outputs to ES5 and it looks like the version of dynamicImport.js in the es5 build contains an un-transpiled import()

mikeauclair avatar Aug 12 '22 18:08 mikeauclair

I have a potentially related issue during Fastlane build:

[stderr] [!] Error building the application - see the log above
1014
error node_modules/twilio-video/es5/dynamicImport.js: node_modules/twilio-video/es5/dynamicImport.js:Invalid call at line 8: import(
/* webpackIgnore: true */
module).
Error: node_modules/twilio-video/es5/dynamicImport.js:Invalid call at line 8: import(
/* webpackIgnore: true */
module)
    at transformJS (/Users/expo/workingdir/build/node_modules/metro-transform-worker/src/index.js:262:15)
    at transformJSWithBabel (/Users/expo/workingdir/build/node_modules/metro-transform-worker/src/index.js:410:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.transform (/Users/expo/workingdir/build/node_modules/metro-transform-worker/src/index.js:571:12)
info 
1015
Error: Fastlane build failed with unknown error. Please refer to the "Run fastlane" and "Xcode Logs" phases.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.

zaptrem avatar Aug 21 '22 15:08 zaptrem

Hi all,

Thank you for reporting this issue. I was able to reproduce this issue. I have created a ticket to investigate and resolve this (VIDEO-11220). I will be keeping this thread open and update when we get more news!

Best, Joyce

PikaJoyce avatar Aug 22 '22 18:08 PikaJoyce

Hi folks,

There is a current workaround for this issue by updating browserify to v17. Please run the below snippet in order to update browserify.

npm install -S browserify@17

Please utilize this workaround as we continue to investigate this issue and let me know if there are still any issues!

Best, Joyce

PikaJoyce avatar Aug 25 '22 20:08 PikaJoyce

Hi @gburt , @mikeauclair ,

While we troubleshoot the issue, can you set the ECMA version to 2020 in your validator plugin as a temporary workaround?

manjeshbhargav avatar Aug 26 '22 22:08 manjeshbhargav

Hi @gburt , @mikeauclair ,

We have filed an internal ticket and are looking into it.

manjeshbhargav avatar Aug 30 '22 15:08 manjeshbhargav

Hi @gburt , @mikeauclair ,

Can you run npm install twilio/twilio-video.js#2.24.1-rc1 and verify whether it fixes your build issue? We verified on our end that this works.

manjeshbhargav avatar Sep 01 '22 23:09 manjeshbhargav

Hi @gburt , @mikeauclair ,

Can you run npm install twilio/twilio-video.js#2.24.1-rc1 and verify whether it fixes your build issue? We verified on our end that this works.

@manjeshbhargav that builds fine, thanks!

gburt avatar Sep 02 '22 18:09 gburt

Hi Folks,

This issue has now been fixed on the latest version 2.24.1. I will now be closing this issue. But of course, please let us know if you're still running into any issues.

Best, Joyce

PikaJoyce avatar Sep 07 '22 18:09 PikaJoyce