Closed phuctm97 closed 1 year ago
You can configure your bundler. It only does this if you say it is running in a browser (browsers have a document), it doesn't do so in places that have no document (node, deno, worker, react-native).
If you run in a browser but without document, configure your tools: https://github.com/wooorm/parse-entities/issues/19
Hi! This was closed. Team: If this was fixed, please add phase/solved
. Otherwise, please add one of the no/*
labels.
Initial checklist
Affected packages and versions
remark-stringify
Link to runnable example
No response
Steps to reproduce
Import
remark-stringify
into a browser extension's background service worker script. The script initialization will fail immediately with error "document is not defined".I checked the code, it seems like there is a use of
document.createElement("i")
, I'm not sure what it's for.Expected behavior
It should work fine in service worker environment and does not depend on DOM API.
Actual behavior
It depends on
document
and fails in non-DOM environment.Runtime
Node v16
Package manager
yarn 1
OS
macOS
Build and bundle tools
esbuild