twilio / twilio-voice.js

Twilio's JavaScript Voice SDK
Other
50 stars 50 forks source link

"CommonJS or AMD dependencies can cause optimization bailouts" seen during angular build #260

Open seth-church opened 2 months ago

seth-church commented 2 months ago

When building with angular 13, the following is reported:

Warning: /path/goes/here/twilio.service.ts depends on '@twilio/voice-sdk'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Note that the twilio.service.ts file contains: import { Call, Device } from '@twilio/voice-sdk';

We were seeing this issue on the version 1 package, twilio-client. We hoped this to be fixed with the version 2 package, @twilio/voice-sdk, but apparently it's not.

charliesantos commented 2 months ago

Thanks for submitting @seth-church . Can you try importing under the esm path? See this changelog for details https://github.com/twilio/twilio-voice.js/blob/master/CHANGELOG.md#ecmascript-module-support

seth-church commented 2 months ago

Updated the import to: import { Call, Device } from '@twilio/voice-sdk/esm';

Now seeing: Warning: /path/goes/here/node_modules/@twilio/voice-sdk/esm/twilio/uuid.js depends on 'md5'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

charliesantos commented 2 months ago

Thanks for trying @seth-church . We'll put this under our radar.