Closed yeemachine closed 3 years ago
The path ../web_modules/pixi-live2d-display.js
is strange, as it would typically be node_modules/pixi-live2d-display/lib/index.js
. I'm wondering how you used this module, could you provide more information?
I'm currently using Rollup/Snowpack to bundle atm. Here's how im importing. which seems to work this way, compared to how pixi gets imported.
import { Application } from '@pixi/app';
import { Ticker, TickerPlugin } from '@pixi/ticker';
import { Renderer } from '@pixi/core';
import { InteractionManager } from '@pixi/interaction';
import Live2D_Display from 'pixi-live2d-display';
const {Live2DModel} = Live2D_Display
which actually still gets me this error
pixi-live2d-display.js:28405 Uncaught (in promise) TypeError: (intermediate value).add(...).load(...).on is not a function
pixi-live2d-display.js:28405 Uncaught (in promise) TypeError: r.on is not a function
Though I did a quick search on the second problem might needing some semicolons?
Alright, I realized that "strange" path was generated by Snowpack.
The first problem seems to be an incompatibility between Snowpack and commonjs modules, there's a related issue with possible solutions. I will consider releasing both the commonjs module and ES module in the future.
And for the second, it's because Pixi has suddenly obsoleted the EventEmitter
mixin of PIXI.Loader
in v5.3.0, which made the on()
method no longer available. The solution is either use a Pixi version lower than 5.3.0, or wait for the next release of this project, which has removed the dependency of PIXI.Loader
.
Thanks! yup. Updating PIXI to 5.2.4 worked.
I'm getting around it right now by just importing the whole thing, but thought I'd bring it up.