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

vite import dragula error: global is not defined #2778

Closed
6 tasks done
Genhuao opened this issue Mar 30, 2021 · 2 comments
Closed
6 tasks done

vite import dragula error: global is not defined #2778

Genhuao opened this issue Mar 30, 2021 · 2 comments

Comments

@Genhuao
Copy link

Genhuao commented Mar 30, 2021

Describe the bug

I am trying to use dragula in my project. When i import the dragula. There is an error.
img
img
If i don't use vite. There's no problem.

Reproduction

you can clone my project and run it.
https://github.com/Genhuao/vite-test

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

System:
    OS: Windows 10 10.0.18363
    CPU: (4) x64 Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz
    Memory: 1.77 GB / 7.89 GB
  Binaries:
    Node: 12.14.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 89.0.4389.90
    Edge: Spartan (44.18362.449.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    @vitejs/plugin-vue: ^1.1.5 => 1.2.0
    vite: ^2.1.3 => 2.1.4

Used package manager:

Logs


Before submitting the issue, please make sure you do the following

@egoist
Copy link
Contributor

egoist commented Mar 30, 2021

You can manually add a global polyfill in your entry file: bevacqua/dragula#602

@patak-dev
Copy link
Member

patak-dev commented Mar 30, 2021

Vite doesn't include shims for Node variables like Webpack 4 does (in Version 5, shims also needs to be added by the user). Check other issues like #728

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
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

3 participants