0

I am using the twilio-chat package, and webpack. While building the project, I get an error with one of the dependency of twilio-chat:

ERROR in d0c738431e00ec9e6f81.bundle.js from UglifyJs Unexpected token: keyword «const» [./node_modules/twilsock/lib/index.js:3,0][d0c738431e00ec9e6f81.bundle.js:33187,0]

I've added an exclude in the UglifyJsPlugin config (see https://github.com/webpack/webpack/pull/560#issuecomment-67160459), but it seems this doesn't have any effect.

I've also tried adding twilio-chat in the externals config, but that throws some errors.

  externals: {
    'twilio-chat': 'twilio-chat'
  }

Any ideas as to what it should be?

For reference, the twilio chat js sdk documentation is available at https://media.twiliocdn.com/sdk/js/chat/releases/3.3.7/docs/index.html

1 Answers1

0

Answering to myself: it seems UglifyJSPlugin is deprecated and doesn't support ES6 notation – according to https://stackoverflow.com/a/53336031/12316148 – and should be replaced with terser-webpack-plugin