d13 Posted November 22, 2019 Share Posted November 22, 2019 Hi Everyone! I'm trying to install and use the pixi-spine plugin with es6 and webpack. The docs recommend importing it like this: import * as PIXI from "pixi.js"; window.PIXI = PIXI; import "pixi-spine" But, I'm getting the error `PIXI is not defined` Any idea what I could be doing wrong? Thanks! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2019 Share Posted November 22, 2019 (edited) You are doing everything right, its just webpack and npm are very shady guys. 'import' is actually an instruction before all the code , so you have to use require("pixi-spine") there. Edited November 22, 2019 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2019 Share Posted November 22, 2019 Also, just in case: latest pixi-spine supports spine 3.8. If you want models from 3.7, use different version, there's a list in README. Quote Link to comment Share on other sites More sharing options...
d13 Posted November 22, 2019 Author Share Posted November 22, 2019 Wow, thanks Ivan, using `require` worked! I would never have thought it! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
bubamara Posted November 22, 2019 Share Posted November 22, 2019 the other way is to use webpack's provide plugin : plugins: [ new webpack.ProvidePlugin({ PIXI: 'pixi.js' }) ] ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2019 Share Posted November 22, 2019 Thank you, @Bubamara ! I will reference your post and put it in all my plugins Quote Link to comment Share on other sites More sharing options...
bubamara Posted November 23, 2019 Share Posted November 23, 2019 you’re welcome ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.