Open mybearworld opened 7 months ago
I am getting this same issue on MacOS 14.5 and Bun 1.1.18. I have tried the following two vite.config.js
but it did not work.
import { defineConfig } from 'vite';
import topLevelAwait from "vite-plugin-top-level-await";
export default defineConfig({
plugins: [
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: "__tla",
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: i => `__tla_${i}`
})
]
});
import { defineConfig } from "vite";
import topLevelAwait from "vite-plugin-top-level-await";
export default defineConfig({
plugins: [topLevelAwait()],
});
Some other files that may help.
{
"name": "iso-game",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"update": "bun upgrade && bun update",
"dev": "bunx --bun vite",
"build": "tsc && vite build && biome check .",
"preview": "vite preview",
"format": "biome format ."
},
"devDependencies": {
"@types/bun": "latest",
"@types/three": "^0.166.0",
"biome": "^0.3.3",
"typescript": "^5.5.3",
"vite": "^5.3.3",
"vite-plugin-top-level-await": "^1.4.1"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"three": "^0.166.1"
}
}
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
"types": ["@types/three", "@types/bun", "three",
"three/examples/jsm/controls/OrbitControls",
"three/addons/capabilities/WebGPU",
"three/addons/renderers/webgpu/WebGPURenderer",
"three/addons/libs/stats.module"],
},
"include": ["src/**/*"]
}
Same issue, running on bun -v 1.1.25
Same error here, with bun 1.1.29
What version of Bun is running?
1.1.0+5903a6141
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What steps can reproduce the bug?
When a Vite project uses
vite-plugin-top-level-await
, the dev server doesn't start with Bun.What is the expected behavior?
The server starts correctly. This behavior is seen with
bun run dev
:What do you see instead?
The server doesn't start, instead giving an error:
(I've edited the error message not to include my username - instead of
.\
, the errors contain the absolute path to the file.)Additional information
No response