Skip to content

import devtools from '@vue/devtools' gets into Vite production build #1961

@segevfiner

Description

@segevfiner

Version

6.4.3

Browser and OS info

Chrome 105 / macOS 12.6

Steps to reproduce

  1. Create an empty vite project
  2. Add import devtools from '@vue/devtools' &
    if (import.meta.env.MODE === 'development') {
      devtools.connect()
    }
  3. Build the production build. @vue/devtools doesn't get tree shaken and gets into the production build. I have also seen cases of it importing node specific code which leads to an undefined import to emitter.

What is expected?

For it to be tree shaken so it is easy to include @vue/devtools standalone only for dev builds

What is actually happening?

It is not tree shaken


Without it being tree shaken, I will have to manually comment/uncomment it. I haven't found a way to direct it to tree shake @vue/devtools outside of modifying its package.json and adding "sideEffects": false. It still spews a huge amount of eval warnings despite this which I have no idea how to silence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions