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

Call to Node module failed with error: ReferenceError: document is not defined #447

Open
aaltotsky opened this issue Dec 2, 2016 · 1 comment · May be fixed by #690
Open

Call to Node module failed with error: ReferenceError: document is not defined #447

aaltotsky opened this issue Dec 2, 2016 · 1 comment · May be fixed by #690

Comments

@aaltotsky
Copy link

In your dragula.js there is a windows object defined if it does not exist. Could you also define the document object?
Otherwise, we are getting the error:

Call to Node module failed with error: ReferenceError: document is not defined

@ShadowManu
Copy link

I was also trying to use (at least just require) dragula under a nodejs context. To fix this issue there are 2 appearances of document, which is not defined:

  1. Inside the crossvent dependency: they fixed this internally in latest version 1.5.5. dragula is using version 1.5.4.
  2. Inside the dragula.js file. Here the usage is much more coupled to fix easily.

While the first issue can be fixed easily, the second can't. I'm going to try defining a fake document global before requiring dragula and will comment back how it turns out.

gristow added a commit to gristow/dragula that referenced this issue Mar 12, 2022
Moves references to document within functions so that dragula can be required/imported in a non-browser context. (Does not enable server-side rendering.)
@gristow gristow linked a pull request Mar 12, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants