Skip to content

Next.js - ReferenceError: document is not defined #48

Closed
@tmilciunas

Description

@tmilciunas

Hello, I am using Next.js and can't manage to load this library to work. It throws two errors:

First (warning):

./node_modules/.pnpm/jsprintmanager@5.0.1/node_modules/jsprintmanager/JSPrintManager.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Second (breaking error):

ReferenceError: document is not defined

~/node_modules/.pnpm/jsprintmanager@5.0.1/node_modules/jsprintmanager/JSPrintManager.js (2:41314)
~/node_modules/.pnpm/jsprintmanager@5.0.1/node_modules/jsprintmanager/JSPrintManager.js (2:513)
...

I am using jsprintmanager@5.0.1, package is being imported like so: import * as JSPM from 'jsprintmanager'.

Crashes happen with a simple line of JSPM.JSPrintManager.auto_reconnect = true anywhere in the code, so I can't debug it, since it crashes instantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions