davidfig / pixi-viewport

A highly configurable viewport/2D camera designed to work with pixi.js
https://davidfig.github.io/pixi-viewport/
MIT License
1.04k stars 174 forks source link

Uncaught SyntaxError: Cannot use import statement outside a module (at pixi_viewport.js:4:1) #452

Open dustinbolton opened 1 year ago

dustinbolton commented 1 year ago

I am simply just trying to test this out in a web browser using the sample code from the documentation. For the life of me I cannot find any way to get this thing to work using the most basic of examples:

<script src="pixi.js"></script>
<script src="pixi_viewport.js"></script>
<script>
    const Viewport = new pixi_viewport.Viewport(options)
</script>

I get error Uncaught SyntaxError: Cannot use import statement outside a module (at pixi_viewport.js:4:1) I tried adding type="module" for pixi_viewport.js but then get error Uncaught TypeError: Failed to resolve module specifier "@pixi/core". Relative references must start with either "/", "./", or "../".

I've tried other more complicated ways of setting up an ES environment for it and still no luck. I've never in my life had trouble getting a JS project functioning like this.

Is the documentation obsolete? How can I actually get it to work?

dschumak commented 4 months ago

I am also getting this same problem, were you ever able to resolve?