{"id":683,"hash":"b9cf39ee0a4333679f7759868418d68d2061f686b72a3c8caf9c6551cb1270c6","pattern":"How to solve error &quot;Big integer literals are not available in the configured target environment&quot; on vite?","full_message":"I am using vite, react and typescript then i got this error, anyone knows how to solve it ?\n\nHere is my package.json:\n\n{\n  \"name\": \"\",\n  \"private\": true,\n  \"version\": \"0.0.0\",\n  \"scripts\": {\n    \"dev\": \"vite\",\n    \"build\": \"tsc && vite build\",\n    \"preview\": \"vite preview\"\n  },\n  \"dependencies\": {\n    \"@apollo/client\": \"^3.7.9\",\n    \"@composedb/cli\": \"^0.3.1\",\n    \"@composedb/client\": \"^0.3.1\",\n    \"@didtools/pkh-ethereum\": \"^0.0.3\",\n    \"@emotion/react\": \"^11.9.0\",\n    \"@emotion/styled\": \"^11.8.1\",\n    \"@mui/icons-material\": \"^5.8.4\",\n    \"@mui/material\": \"^5.8.2\",\n    \"@mui/x-date-pickers\": \"^5.0.0-alpha.5\",\n    \"cytoscape\": \"^3.22.1\",\n    \"date-fns\": \"^2.28.0\",\n    \"did-session\": \"^1.0.0\",\n    \"graphql\": \"^16.6.0\",\n    \"graphql-tag\": \"^2.12.6\",\n    \"moment\": \"^2.29.4\",\n    \"react\": \"^18.0.0\",\n    \"react-dom\": \"^18.0.0\",\n    \"react-router-dom\": \"^6.3.0\",\n    \"web3\": \"^1.8.2\"\n  },\n  \"devDependencies\": {\n    \"@types/cytoscape\": \"^3.19.6\",\n    \"@types/react\": \"^18.0.0\",\n    \"@types/react-dom\": \"^18.0.0\",\n    \"@vitejs/plugin-react\": \"^1.3.0\",\n    \"axios\": \"^0.27.2\",\n    \"typescript\": \"^4.6.3\",\n    \"vite\": \"^2.9.9\"\n  }\n}\n\nLogs:\n\n✘ [ERROR] Big integer literals are not available in the configured target environment (\"chrome87\", \"edge88\", \"es2019\", \"firefox78\", \"safari13.1\")\n\nnode_modules/bigint-mod-arith/dist/esm/index.browser.js:231:16:\n  231 │         e = e / 2n;\n      ╵                 ~~\n\n✘ [ERROR] Big integer literals are not available in the configured target environment (\"chrome87\", \"edge88\", \"es2019\", \"firefox78\", \"safari13.1\")\n\nnode_modules/bigint-mod-arith/dist/esm/index.browser.js:232:17:\n  232 │         b = b ** 2n % n;\n      ╵                  ~~\n\n7:04:56 AM [vite] error while updating dependencies: Error: Build failed with 68 errors:\nnode_modules/bigint-mod-arith/dist/esm/index.browser.js:21:14: ERROR:\nBig integer literals are not available in the configured target environment (\"chrome87\", \"edge88\", \"es2019\", \"firefox78\", \"safari13.1\")\nnode_modules/bigint-mod-arith/dist/esm/index.browser.js:27:20: \nERROR:\nBig integer literals are not available in the configured target environment (\"chrome87\", \"edge88\", \"es2019\", \"firefox78\", \"safari13.1\")\nnode_modules/bigint-mod-arith/dist/esm/index.browser.js:27:26: ERROR:\nBig integer literals are not available in the configured target environment (\"chrome87\", \"edge88\", \"es2019\", \"firefox78\", \"safari13.1\")\nnode_modules/bigint-mod-arith/dist/esm/index.browser.js:47:13: ERROR:\nBig integer literals are not available in the configured target environment (\"chrome87\", \"edge88\", \"es2019\", \"firefox78\", \"safari13.1\")\nnode_modules/bigint-mod-arith/dist/esm/index.browser.js:47:24: ERROR:\nBig integer literals are not available in the configured target environment (\"chrome87\", \"edge88\", \"es2019\", \"firefox78\", \"safari13.1\") ...\nat failureErrorWithLog \n[...]\n\nI tried, deleting node_modules and pnpm-lock-yaml and reinstalling them but the problem is still there.","ecosystem":"npm","package_name":"reactjs","package_version":null,"solution":"I solved it on vite 3.2.x and 4.1.x (with Svelte instead of React, but it should work) by defining the following vite config's options:\n\noptimizeDeps.esbuildOptions.target\noptimizeDeps.global\noptimizeDeps.esbuildOptions.supported.bigint\nbuild.target\n\nimport { defineConfig } from \"vite\";\n// import react, svelte and other needs...\n\n// https://vitejs.dev/config/\nexport default ({ mode }) => {\n\n  return defineConfig({\n    \n    optimizeDeps: { // 👈 optimizedeps\n      esbuildOptions: {\n        target: \"esnext\", \n        // Node.js global to browser globalThis\n        define: {\n          global: 'globalThis'\n        },\n        supported: { \n          bigint: true \n        },\n      }\n    }, \n\n    build: {\n      target: [\"esnext\"], // 👈 build.target\n    },\n  })\n}","confidence":0.8,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/75576741/how-to-solve-error-big-integer-literals-are-not-available-in-the-configured-tar","votes":6,"created_at":"2026-04-19T04:51:28.859680+00:00","updated_at":"2026-04-19T04:51:28.859680+00:00"}