excaliburjs/excalibur-tiled

Just doesn't work, as a browser script

Closed this issue · 5 comments

mn113 commented

I have Excalibur working on my page. But when I npm install and add this script in a script tag, it just doesn't load Extensions as a global or anywhere else, and I can't continue.

HTML

<script src="node_modules/excalibur/dist/excalibur.js"></script>
<script src="node_modules/@excaliburjs/excalibur-tiled/dist/excalibur-tiled.min.js"></script>
<script src="js/game.js"></script>

JS

var game = new ex.Engine({
width: 800,
height: 600
});

var map = new Extensions.Tiled.TiledResource("tiled/test.json");

Error in console

Uncaught ReferenceError: Extensions is not defined

Browser is Chrome 67. Versions are excalibur@0.18.0 and excalibur-tiled@2.3.0. My files are served from a local MAMP server (http://localhost:8888/...) and all the scripts show as being fetched (200 OK). Any hints? Is Webpack mandatory here?

@mn113 Webpack should not be required, we'll have a chance to look at this during our weekly meeting tonight

/cc @kamranayub

@mn113 I think something went wrong in the output, this seems to work as a workaround for now new window["Extensions.Tiled"].default

@mn113 I think we have a fix, webpack allows multipart library configuration which is what we want https://github.com/webpack/webpack/tree/master/examples/multi-part-library

/cc @kamranayub

mn113 commented

The new PR seems to fix my problem.

Thanks for your quick work in responding to this @eonarheim.