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

fix: [#483] Add optional JSDOM dependency for Node #487

Conversation

jfelsinger
Copy link
Contributor

closes #483

This PR adds jsdom as an optional dependency that can be detected and used in environments that don't have support for the browser-internal DOMParser.

Caveats: This also fixes the graphics component breaks I was running into when trying to run headless to actually test this. I can move that out into a separate Issue & PR if that makes sense to do. Essentially, I removed the loading of the actual image/sprite/animations when headless since it was breaking in Node when a browser graphic context wasn't there, even though headless would imply that not being necessary.

Usage

When planning to use excalibur-tiled in Node.js or another non-browser environment, include jsdom when installing excalibur-tiled...

npm i --save @excaliburjs/plugin-tiled@next jsdom

or any time after if it's needed.

npm i --save jsdom

@eonarheim
Copy link
Member

@jfelsinger Looks like CI wants the package-lock.json

@jfelsinger
Copy link
Contributor Author

Very weird, I thought I included that in the initial commit. Lock file updated & pushed.

@eonarheim
Copy link
Member

@jfelsinger Pushed a commit to tweak the CI webpack config quick, all the tests passed locally so I expect to merge this momentarily!

@eonarheim eonarheim merged commit dd65562 into excaliburjs:main Jan 17, 2024
2 checks passed
@eonarheim
Copy link
Member

@jfelsinger Many thanks for digging into this! Much appreciated! ⚔️

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 this pull request may close these issues.

DOMParser doesn't exist in headless/non-browser environments
2 participants