Skip to content

Investigate why terser/webpack defaults causes SDK code to break  #11212

Closed

Description

@AbhiPrasad

full context in this discord thread: https://discord.com/channels/621778831602221064/1217467422932729918/1220020216336093225

Terser inlining causing issues?

Activity

  1. AbhiPrasad commented on Mar 20, 2024

    @AbhiPrasad
    ContributorAuthor

    terser itself doesn't have these minify levels so I'm guessing webpack adds these

    From Tim on discord

  2. timfish commented on Mar 20, 2024

    @timfish
    Collaborator

    Terser itself doesn't appear to have minify levels, all the different options are configured individually:
    https://github.com/terser/terser?tab=readme-ov-file#compress-options

    What level option is being referred to in the webpack config?
    https://webpack.js.org/plugins/terser-webpack-plugin/

  3. AbhiPrasad commented on Mar 21, 2024

    @AbhiPrasad
    ContributorAuthor
  4. timfish commented on Mar 21, 2024

    @timfish
    Collaborator

    Ah ok so it's the inline levels!

    options: { compress: { inline: 1 } }

  5. timfish commented on Mar 23, 2024

    @timfish
    Collaborator

    I've added tests for both webpack 4 and 5 and backported them to the v7 branch to see if there are any failures.

    We don't see any issues with the default terser config #11257

    The webpack config looks like this:

    import * as path from 'path';
    import HtmlWebpackPlugin from 'html-webpack-plugin';
    import TerserPlugin from 'terser-webpack-plugin';
    import webpack from 'webpack';
    
    webpack({
        entry: path.join(__dirname, 'entry.js'),
        output: {
          path: path.join(__dirname, 'build'),
          filename: 'app.js',
        },
        optimization: {
          minimize: true,
          minimizer: [new TerserPlugin()],
        },
        plugins: [new HtmlWebpackPlugin(), new webpack.EnvironmentPlugin(['E2E_TEST_DSN'])],
        mode: 'production',
      })
  6. mydea commented on Mar 25, 2024

    @mydea
    Member

    I wonder if this may be related to #10566 - ember uses terser under the hood 🤔 there the problem seemed to be related to tree shaking & minifying, somehow.

  7. timfish commented on Mar 25, 2024

    @timfish
    Collaborator

    Maybe my test cases should at least access more of the SDK API?

  8. mydea commented on Jul 4, 2024

    @mydea
    Member

    I think this is hopefully fixed, let's close this for now.

  9. ghost added on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions