azerion / phaser-spine

A plugin for Phaser 2 that adds Spine support
MIT License
121 stars 58 forks source link

Webpack - anyone have a working example? #41

Closed iangregsondev closed 7 years ago

iangregsondev commented 7 years ago

Hi,

Trying to import the phaser-spine.js via webpack using either import (es2015) or require but I can't get anything to work.

I thought I may have to use the expose-loader as I think its a global variable PhaserSpine but still no avail.

Anyone help ?

lukz commented 7 years ago

Example would be useful. I'm also looking for some way to load skeleton with webpack. Webpack generates random hash for filename and since phaser-spine plugin doesn't allow to specify png filename it's looking for missing png file.

iangregsondev commented 7 years ago

HI @lukz , I was even able to get that far :-( But then I thought, why don;t i use typescript directly? This seems a better way than importing the JS but I need to know the relationship between the TS files.

With regards to webpack creating hash files, you have 2 options, this can be disabled OR when you import the PNG (or what ever) it normally return the new filename using the hash if you are using the file-loader

Hope that helps

AleBles commented 7 years ago

I have a test setup for experimenting with webpack where it works, maybe it can help you, here's the gist of it: https://gist.github.com/AleBles/73dea441e1c926f8924cdcf42e45333f

iangregsondev commented 7 years ago

Thanks, I will take a look.