Skip to content

Runtime error in production build of DLL which contains package with "sideEffects": false and not used module #9146

@mifopen

Description

@mifopen

Bug report

What is the current behavior?
Uncaught TypeError: Cannot read property 'call' of undefined

If the current behavior is a bug, please provide the steps to reproduce.
Minimal reproduction: https://github.com/mifopen/webpack-bug-example
@sentry/browser is used as an example of package with "sideEffects": false
Steps to reproduce:

  1. Clone the repo
  2. Run yarn/npm run build-vendor
  3. Run yarn/npm run build-app
  4. Open index.html file in browser
  5. Open console to see error

Why?
Module LogLevel from @sentry/types (dep of @sentry/browser) is exported from the package but isn't used. webpack excludes it from DLL because of production mode and "sideEffects": false, but DllPlugin somehow requires it anyway.

What is the expected behavior?
Generate DLL without unused modules at all

Other relevant information:
webpack version: 4.31.0
Node.js version: 11.1
Operating System: macos 10.14.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions