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

EventEmitter3 Default Export Error in Browser Environment with PixiJS #2

Closed
WRXinYue opened this issue Oct 14, 2024 · 0 comments
Closed

Comments

@WRXinYue
Copy link
Member

Description:

When using PixiJS in a browser environment, it attempts to import eventemitter3 via require. This causes the following error at runtime:

Uncaught (in promise) SyntaxError: The requested module '/@fs/home/wrxinyue/projects/valaxy-theme-sakura/node_modules/.pnpm/[email protected]/node_modules/eventemitter3/index.js?v=c765f9a9' does not provide an export named 'default' (at index.mjs?v=c765f9a9:3:10)

Solution:

To resolve this issue, include the necessary dependencies using optimizeDeps.include in your Vite configuration to ensure the dependencies are pre-optimized during development. Example:

import { defineValaxyConfig } from 'valaxy'

export default defineValaxyConfig({
  vite: {
    optimizeDeps: {
      include: ['@pixi/utils'],
    },
  },
})

Related Issues:

WRXinYue added a commit that referenced this issue Oct 14, 2024
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

1 participant