Open lithdew opened 9 months ago
Any error messages or logs ? Need more info
Any error messages or logs ? Need more info
There appears to be no error messages or logs.
Here's a reproduction: https://stackblitz.com/edit/vinxi-test?file=src%2Frouter.tsx
The top-level await happens in src/router.tsx in export const trpc = ...
.
Run npm run build && node .output/server/index.mjs
and the server will immediately close on startup.
Running npm run dev
however works.
I'm also able to run my solid start project in dev, but building and running production just exits without any message.
Is this an esbuild limitation? https://github.com/evanw/esbuild/issues/253
in my case.when set target to esnext or support top-level-await,it can build but can't start error is:
File URL path must be absolute
look at compiled code
globalThis._importMeta_=globalThis._importMeta_||{url:"file:///_entry.js",env:process.env};
//...
var __filename = fileURLToPath(globalThis._importMeta_.url);
it seems that esbuild doesn't handle import.meta
correctly
even if I set import-meta
to true ,it doesn't work esbuild_supported
const serverConfig = {
esbuild: {
options: {
supported: {
'top-level-await': true,
'import-meta': true,
},
},
},
}
I remove all import.meta
in source code and now it work
I was looking to use top-level await in my application which appears to only be available on targets ES2022/ESNext. The server built by default targets ES2019.
app.config.ts
:Running
node .output/server/index.mjs
on the built output causes the server to exit immediately on startup. I am using Node v18.16. In dev mode, the application runs fine.