Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npm export error #14

Closed
yeemachine opened this issue Dec 21, 2020 · 4 comments
Closed

Npm export error #14

yeemachine opened this issue Dec 21, 2020 · 4 comments

Comments

@yeemachine
Copy link

SyntaxError: The requested module '../web_modules/pixi-live2d-display.js' does not provide an export named 'Live2DModel'

I'm getting around it right now by just importing the whole thing, but thought I'd bring it up.

import Live2D_Display from 'pixi-live2d-display';
const Live2DModel = Live2D_Display.Live2DModel
@guansss
Copy link
Owner

guansss commented Dec 21, 2020

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?

@yeemachine
Copy link
Author

yeemachine commented Dec 21, 2020

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?

@guansss
Copy link
Owner

guansss commented Dec 22, 2020

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.

@yeemachine
Copy link
Author

Thanks! yup. Updating PIXI to 5.2.4 worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants