phaser-on-nodejs icon indicating copy to clipboard operation
phaser-on-nodejs copied to clipboard

localStorage is not available for opaque origins

Open ilackarms opened this issue 2 years ago • 6 comments

Describe the bug Cannot run a project which imports phaser-on-nodejs in dev mode.

When refreshing the page, i get the error SecurityError: localStorage is not available for opaque origins

Seems this is supposedly caused by jest and JSDOM, but none of the fixes suggested in the issues i've found have worked

ilackarms avatar Jan 06 '23 15:01 ilackarms

What's the project. Is it open source? I suggest using arcade-physics instead.

yandeu avatar Jan 06 '23 16:01 yandeu

was not able to et arcade-physics working with scene.physics.overlapRect

ilackarms avatar Jan 07 '23 05:01 ilackarms

Support for overlap has been added 4 days ago. See https://github.com/yandeu/arcade-physics/blob/main/test/overlap.test.js

yandeu avatar Jan 07 '23 09:01 yandeu

interesting. i still need the ability to read in tilemaps for collisions and object layers. is that possible with arcade-physics?

ilackarms avatar Jan 07 '23 17:01 ilackarms

not sure if thats fully related to this but I had a bunch of similar issues. Try changing this line from the dist https://github.com/geckosio/phaser-on-nodejs/blob/master/src/index.ts#L10 to read have an URL:

-const dom = new JSDOM(`<!DOCTYPE html><body></body>`);
+const dom = new JSDOM(`<!DOCTYPE html><body></body>`, {
+  url: 'http://localhost/'
+});

zewa666 avatar Jan 13 '23 18:01 zewa666

interesting. i still need the ability to read in tilemaps for collisions and object layers. is that possible with arcade-physics?

Not yet, but I plan to implement it.

yandeu avatar Jan 18 '23 10:01 yandeu