8000 `vite-plugin-imba` causes 'Module "crypto" has been externalized for browser compatibility warnings · Issue #894 · imba/imba · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

vite-plugin-imba causes 'Module "crypto" has been externalized for browser compatibility warnings #894

New issue
8000

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

Open
stopachka opened this issue Jun 7, 2024 · 0 comments
Labels

Comments

@stopachka
Copy link

Description

Hey team, an imba user reported an error in my project, and I ran across a peculiar situation.

In plain vite, If import object-hash, I see no warnings.

However, if I import the same package in an imba project, I see the following warning:

 Cannot access "crypto.getHashes" in client code. See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

Looking at the URL that vite points too, it seems to say that object-hash is requiring a nodejs module.

However, this doesn't seem to be the case, when importing object-hash in plain vite. I wonder if there's some environment error that is going on when used with imba.

All thoughts much appreciated!

I created a repro that you can try here:

https://github.com/stopachka/vite-imba-externalized-bug

cd vite-plain 
bun install 
bun run dev 
# Open the browser and see no warnings. 

cd vite-with-imba 
bun install
bun run dev 
# Open the browser and see the warning.

Reproduction

https://github.com/stopachka/vite-imba-externalized-bug

System Environment

System:
    OS: macOS 13.2
    CPU: (12) arm64 Apple M2 Max
    Memory: 20.17 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.7.0 - ~/Library/Caches/fnm_multishells/11913_1717727206664/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/11913_1717727206664/bin/yarn
    npm: 10.1.0 - ~/Library/Caches/fnm_multishells/11913_1717727206664/bin/npm
    pnpm: 8.14.0 - ~/Library/Caches/fnm_multishells/11913_1717727206664/bin/pnpm
    bun: 1.1.12 - ~/.bun/bin/bun
    Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 16.3
  npmPackages:
    imba: ^2.0.0-alpha.235 => 2.0.0-alpha.235
@stopachka stopachka added the bug label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant
0