Vinxi server build fails: Big integer literals not available in target environment ("es2019")

I am getting an error when building locally as well as when Netlify tries to build:
.../.vinxi/build/ssr/index.js:1:40327: ERROR: Big integer literals are not available in the configured target environment ("es2019")
I have looked through the Solid Start, Vinxi and Nitro docs to try to figure out where I can configure this to use a more modern target environment. My app.config.ts currently looks like this:
export default defineConfig({
ssr: true,
server: {
prerender: {
routes: ["/", "/about", "/manage"],
},
},
vite: {
optimizeDeps: {
include: [
"@perawallet/connect",
"@blockshake/defly-connect",
"@walletconnect/modal",
"@walletconnect/sign-client",
"algosdk",
],
esbuildOptions: {
target: "es2020",
// Node.js global to browser globalThis
define: {
global: "globalThis",
},
supported: {
bigint: true,
},
},
},
build: {
target: ["es2020"],
commonjsOptions: {
transformMixedEsModules: true,
},
},
esbuild: { drop: ["console"] },
},
})
export default defineConfig({
ssr: true,
server: {
prerender: {
routes: ["/", "/about", "/manage"],
},
},
vite: {
optimizeDeps: {
include: [
"@perawallet/connect",
"@blockshake/defly-connect",
"@walletconnect/modal",
"@walletconnect/sign-client",
"algosdk",
],
esbuildOptions: {
target: "es2020",
// Node.js global to browser globalThis
define: {
global: "globalThis",
},
supported: {
bigint: true,
},
},
},
build: {
target: ["es2020"],
commonjsOptions: {
transformMixedEsModules: true,
},
},
esbuild: { drop: ["console"] },
},
})
And tsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"lib": ["es2020", "esnext"],
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"noEmit": true,
"strict": true,
"types": ["vinxi/types/client"],
"isolatedModules": true,
"paths": {
"~/*": ["./src/*"]
}
}
}
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"lib": ["es2020", "esnext"],
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"noEmit": true,
"strict": true,
"types": ["vinxi/types/client"],
"isolatedModules": true,
"paths": {
"~/*": ["./src/*"]
}
}
}
Nothing in either config file seems to have any impact on this "configured target environment" so any help on how I can reconfigure this would be much appreciated!
3 Replies
kissa
kissa3mo ago
Looks like it belongs to the "server" configuration option, here's a minimal setup to make BigInt work:
export default defineConfig({
server: {
esbuild: {
options: {
target: 'es2022'
}
},
}
})
export default defineConfig({
server: {
esbuild: {
options: {
target: 'es2022'
}
},
}
})
I agree that app configuration is difficult and not very thoroughly documented. This required lots of digging into vinxi and nitropack internals, searching for "es2019" inside node_modules/nitropack finally found it.
SilentRhetoric
SilentRhetoricOP3mo ago
Hey! I never saw this until now! Should'a tagged me! Thank you SO much for this! It immediately solved my problem. I had the config elsewhere instead of under server:, and so it was not having any effect on the server build 🤦‍♂️. I was pulling my hair out trying to troubleshoot this... 😅 Where does this need to be documented? In the Vinxi config docs?/
gac5222
gac52222w ago
Hey I was having the same issue and this solved it for me too! Thanks for posting the question and thanks to kissa for the solution!
Want results from more Discord servers?
Add your server