twiceburnt
twiceburnt
CDCloudflare Developers
Created by w7a9q on 4/8/2025 in #workers-help
Vite on Workers
you may need to add a tsconfig.worker.json file
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
"types": ["./worker-configuration.d.ts", "vite/client"]
},
"include": ["server"]
}
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
"types": ["./worker-configuration.d.ts", "vite/client"]
},
"include": ["server"]
}
and reference it in the tsconfig.json file
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.worker.json"
}
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.worker.json"
}
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
then generate the worker-configuration.d.ts with wrangler types
2 replies