Open tsujp opened 6 months ago
1.0.30+1424a196f
Darwin 23.3.0 arm64 arm
Source files are lower down in this section for your copy-pasting.
bun run build_bun.ts
Bun.serve
bun run build_esbuild.mjs
./src/index.ts
import { Application } from 'pixi.js' const app = new Application() await app.init({ width: 640, height: 360 }) document.body.appendChild(app.canvas)
index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Foobar</title> <style> body { margin: 0; } </style> </head> <body> <script type="module" src="../out/index.js"></script> </body> </html>
build_bun.ts
// The resulting bundle fails to run in both Firefox and Chrome. await Bun.build({ entrypoints: ['./src/index.ts'], outdir: './out', })
build_esbuild.mjs
import * as esbuild from 'esbuild' // Note not even specifically targeting browsers in esbuilds config. await esbuild.build({ entryPoints: ['./src/index.ts'], bundle: true, outfile: './out/index.js', format: 'esm' })
package.json
{ "name": "foo", "private": true, "version": "0.1.0", "author": "foo", "license": "BSD-3-Clause", "type": "module", "scripts": {}, "repository": { "type": "git" }, "keywords": [], "dependencies": { "pixi.js": "^8.0.1" }, "devDependencies": { "@types/bun": "^1.0.0", "esbuild": "^0.20.1" } }
$ bun pm ls ├── @types/bun@1.0.8 ├── esbuild@0.20.1 └── pixi.js@8.0.1
Seeing a black WebGL canvas of the specified resolution with no errors in the browser console.
A DOM without a WebGL canvas and the following (equivalent) errors in the console for Firefox and Chrome respectively.
TypeError: class heritage eventemitter3_default is not an object or null <anonymous> http://localhost:3000/out/index.js:2610
Uncaught TypeError: Class extends value undefined is not a constructor or null at index.js:2610:25
Browsers tested:
See: https://github.com/tsujp/pixijs_bun_bug_mre
I've added an MRE repo for easier bug squashing: https://github.com/tsujp/pixijs_bun_bug_mre
What version of Bun is running?
1.0.30+1424a196f
What platform is your computer?
Darwin 23.3.0 arm64 arm
What steps can reproduce the bug?
Execution steps
Source files are lower down in this section for your copy-pasting.
bun run build_bun.ts
and useBun.serve
to observe the reported error.bun run build_esbuild.mjs
and useBun.serve
to see a black WebGL canvas created without error.Source files
./src/index.ts
index.html
Build files
Bun's version:
build_bun.ts
esbuild's version:
build_esbuild.mjs
Packages
package.json
Resolved package versions
What is the expected behavior?
Seeing a black WebGL canvas of the specified resolution with no errors in the browser console.
What do you see instead?
A DOM without a WebGL canvas and the following (equivalent) errors in the console for Firefox and Chrome respectively.
Additional information
Browsers tested:
Minimal Reproduceable Example
See: https://github.com/tsujp/pixijs_bun_bug_mre