Skip to content

package name contain "/" will cause class name change #7858

@bruceyongli

Description

@bruceyongli

Describe the bug

For example:
import { Pose } from "@mediapipe/pose"
const p = new Pose();

Will build to:
const p = new Gu.Pose();

It seems any package name containing a "/" will cause the building process to prepend a name to the new class constructor.

And it will cause TypeError: Gu.Pose is not a constructor.

My current workaround is to remove the name appending after the project is built.


"vite": "^2.9.2"
"vue": "^3.2.25"

Reproduction

https://github.com/ElementLi/vite-build-error

System Info

System:
    OS: macOS 12.3
    CPU: (8) arm64 Apple M1
    Memory: 72.73 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.15 - ~/node_modules/.bin/yarn
    npm: 8.4.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 100.0.4896.127
    Firefox: 73.0.1
    Safari: 15.4
  npmPackages:
    @vitejs/plugin-vue: ^2.3.1 => 2.3.1
    vite: ^2.9.2 => 2.9.5

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions