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

The most common import scenario doesn't work #6

Closed
mreinstein opened this issue Jan 6, 2025 · 2 comments
Closed

The most common import scenario doesn't work #6

mreinstein opened this issue Jan 6, 2025 · 2 comments

Comments

@mreinstein
Copy link
Contributor

I would expect this to work:

import * as Box2D from 'phaser-box2d'

// do stuff with Box2D here, e.g.,
Box2D.b2CreateWorldArray()
const worldDef = Box2D.b2DefaultWorldDef()

This fails. Looking at package.json it's got "main": "index.js" Should this instead be something like "main": "dist/PhaserBox2D.js" ?

It's unintuitive, having to write:

import * as Box2D from 'phaser-box2d/dist/PhaserBox2D.js'
@mikuso
Copy link
Contributor

mikuso commented Jan 6, 2025

Funnily enough, I asked for the same thing in the #box2d channel in the Discord at about the same time you opened this issue.

Instinctively, it makes sense to me to set main to "src/main.js", unless there's a reason to prefer a pre-built version?

@photonstorm
Copy link
Contributor

The pre-built version doesn't have any expensive console assertions in it (or the weighty debug renderer).

photonstorm added a commit that referenced this issue Jan 7, 2025
refactor: make most common import case work. fixes #6
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

3 participants