Open redexp opened 1 year ago
Are you using esModuleInterop: true
in tsconfig.json?
Are you using
esModuleInterop: true
in tsconfig.json?
I'm not, because I'm not using typescript in my project, but my IDE goes down to this error and can't resolve any EventEmiter methods. Also I seeing repeating issues about same problem, which can be solved easily from your side without needing users to know about any typescript configs
@SuperSodaSea I can create PR
@redexp Feel free to create the PR :)
I just ran into this bug with a completely normal vanilla JavaScript + Rollup setup.
Here is a gist of my code. Download it as ZIP, then do yarn install
and then yarn build
. You will get this error:
[!] RollupError: "default" is not exported by "node_modules/eventemitter3/index.js", imported by "node_modules/@pixi/utils/lib/index.mjs".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module
node_modules/@pixi/utils/lib/index.mjs (3:9)
1: import './settings.mjs';
2: export { isMobile } from '@pixi/settings';
3: export { default as EventEmitter } from 'eventemitter3';
^
4: export { default as earcut } from 'earcut';
5: export { url } from './url.mjs';
Unfortunately this makes Pixi completely unusable with ES6-compliant bundlers like Rollup.
This issue has kept rearing it's ugly head in multiple projects I've worked on. The exports of eventemitter3 are inherently f**ked. esModuleInterop true or false, it doesn't matter
I'm getting this with rollup trying to make a worker.
pixi.js@8.3.4
rollup@4.21.2
14:13:23 [vite] Internal server error: ../../node_modules/pixi.js/node_modules/eventemitter3/index.mjs (1:7): "default" is not exported by "../../node_modules/pixi.js/node_modules/eventemitter3/index.js", imported by "../../node_modules/pixi.js/node_modules/eventemitter3/index.mjs".
I'm importing pixi into a webworker via rollup-plugin-worker
, the config for which is:
webworker({
plugins: [
nodeResolve(),
importAsString({ include: ["**/*.glsl"] })
] as Rollup.Plugin[],
}),
nodeResolve({browser: true})
has the same result
Anyone have a workaround?
Current Behavior
methods of EventEmiter not visible in Container eventemitter3 of version 4 exports EventEmiter class as
export = EventEmitter;
(not asexport default
) and in@pixi/utils
it imported asexport { default as EventEmitter } from 'eventemitter3';
which is wrong and produces bugs like #7505 #7865Expected Behavior
methods of EventEmiter are visible in Container class
Steps to Reproduce
Environment
pixi.js
version: 7.2.3@pixi/utils
version: 7.2.3eventemitter3
version: 4.0.7Possible Solution
bump eventemitter3 to version 5 - it's right next version after 4.0.7 and focused only on ESM support
or change code to
export { EventEmitter } from 'eventemitter3';
withoutdefault
Additional Information
No response