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

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

Closed
7 tasks done
bruceyongli opened this issue Apr 22, 2022 · 3 comments
Closed
7 tasks done

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

bruceyongli opened this issue Apr 22, 2022 · 3 comments

Comments

@bruceyongli
Copy link

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

@haoqunjiang
Copy link
Member

Similar to #4680 (comment)
It's not because of the package name, but because the source code is obfuscated.

@bruceyongli
Copy link
Author

You're right. Thanks for pointing it out! I'll follow that one instead.

@bruceyongli
Copy link
Author

bruceyongli commented May 5, 2022

In case you ended up here and need a workaround, try this:

import * as controlpkg from "@mediapipe/control_utils";
const FPS = controlpkg.FPS
const ControlPanel = controlpkg.ControlPanel
const SourcePicker = controlpkg.SourcePicker

@github-actions github-actions bot locked and limited conversation to collaborators May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants