Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional chaining in distributed code breaks webpack 4 #921

Open
stephenhand opened this issue Jun 12, 2024 · 2 comments
Open

Optional chaining in distributed code breaks webpack 4 #921

stephenhand opened this issue Jun 12, 2024 · 2 comments

Comments

@stephenhand
Copy link

stephenhand commented Jun 12, 2024

We are bundling using webpack 4 (this is mandated by the external Twilio framework we use to build and we can't upgrade it)

A single '?.' operator in your output 'dist/module.js' file on line 2013 is breaking the bundling. Manually replacing this with an if check in the node_modules file allows webpack to work.

I see you have addressed similar issues before #727 - would it be possible to fix this one as well?

@ehsanpo
Copy link

ehsanpo commented Aug 23, 2024

I had same issue, solved it by forcing babel to check emoji-mart


{
  test: /\.jsx?$/,
  loader: 'happypack/loader?id=babel',
  exclude: /node_modules\/(?!(emoji-mart)\/).*/,
  },

@cue232s
Copy link

cue232s commented Oct 2, 2024

Solution was similar for me:

{
  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
    }
  }
}
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants