twilio-professional-services / flex-project-template

A starting point for Twilio Flex projects, providing management strategies for various types of artifacts and distributed development
https://twilio-professional-services.github.io/flex-project-template/
Apache License 2.0
64 stars 71 forks source link

Unexpected token on emoji-mart #647

Closed pedrolucasfv closed 1 month ago

pedrolucasfv commented 2 months ago

I'm trying to update my flex-project template with the upstream and i getting this error. I was using the command twilio plugins:install @twilio-labs/plugin-flex@7.0.0

Failed to compile plugin plugin-flex-ts-template-v2.
./node_modules/emoji-mart/dist/module.js 2013:23
Module parse failed: Unexpected token (2013:23)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     unregister() {
|         document.removeEventListener("click", this.handleClickOutside);
>         this.darkMedia?.removeEventListener("change", this.darkMediaCallback);
|         this.unobserve();
|     }
cue232s commented 1 month ago

Try adding this to your webpack.config.js and adding "@babel/plugin-proposal-optional-chaining": "^7.21.0", "@babel/preset-typescript": "^7.12.1", to your package.json


{
          test: /\.jsx?$/,
          exclude: /node_modules\/(?!(emoji-mart)\/).*/,  // Include emoji-mart
          use: {
            loader: 'babel-loader',
            options: {
              presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
              plugins: ['@babel/plugin-proposal-optional-chaining']  // Handles optional chaining
            }
          }
        }
pedrolucasfv commented 1 month ago

I was able to solve it by fixing the version of emoji-mart at 5.5.2 instead of leaving it with the ^ in package.json, as it seems that this problem occurs in version 5.6.0 of emoji-mart

dremin commented 1 month ago

This should be resolved with the latest version of the CLI plugin (7.0.5).

pedrolucasfv commented 3 weeks ago

I tried again with this version (7.0.5) and continuous have this problem with emoji-mart. I need to do something else to resolve this problem with version 5.6.0 of emoji-mart?