Skip to content
This repository was archived by the owner on Jun 15, 2025. It is now read-only.

Commit 104a158

Browse files
committed
patch tsconfig.node.json
1 parent e67f37f commit 104a158

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { execSync, spawn } from 'node:child_process'
44
import { resolve } from 'node:path'
5-
import { readFileSync, writeFileSync } from 'node:fs'
5+
import { readFileSync, writeFileSync, existsSync } from 'node:fs'
66

77
const NPM = 'npm'
88

@@ -107,5 +107,18 @@ viteProcess.on('close', (code) => {
107107
)
108108
writeFileSync(packageJSONPath, modifiedPackageJSON, 'utf8')
109109

110+
// So TypeScript doesn't complain about about String#startsWith in the vite.config.ts
111+
if (existsSync(resolve(cwd, 'tsconfig.node.json'))) {
112+
process.stdout.write('\nPatching tsconfig.node.json\n')
113+
114+
const tsconfigNodeJSONPath = resolve(cwd, 'tsconfig.node.json')
115+
const tsconfigNodeJSON = readFileSync(tsconfigNodeJSONPath, 'utf-8')
116+
const modifiedTsconfigNodeJSON = tsconfigNodeJSON.replace(
117+
'"compilerOptions": {',
118+
'"compilerOptions": {\n "lib": ["ESNext"],'
119+
)
120+
writeFileSync(tsconfigNodeJSONPath, modifiedTsconfigNodeJSON, 'utf8')
121+
}
122+
110123
process.stdout.write(`\nDone!\n\nBuild and run your app with:\nssc build -r ${projectName}`)
111124
})

0 commit comments

Comments
 (0)