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

Commit bfaf96e

Browse files
committed
patching the vite.config.ts to make socket:* modules external
1 parent 104a158 commit bfaf96e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,18 @@ viteProcess.on('close', (code) => {
120120
writeFileSync(tsconfigNodeJSONPath, modifiedTsconfigNodeJSON, 'utf8')
121121
}
122122

123+
// patching the vite.config.ts to make socket:* modules external
124+
if (existsSync(resolve(cwd, 'vite.config.ts'))) {
125+
process.stdout.write('\nPatching vite.config.ts\n')
126+
127+
const viteConfigTSPath = resolve(cwd, 'vite.config.ts')
128+
const viteConfigTS = readFileSync(viteConfigTSPath, 'utf-8')
129+
const modifiedViteConfigTS = viteConfigTS.replace(
130+
'defineConfig({',
131+
'defineConfig({\n build: {\n rollupOptions: {\n external(id) {\n return id.startsWith(\'socket:\')\n }\n }\n },'
132+
)
133+
writeFileSync(viteConfigTSPath, modifiedViteConfigTS, 'utf8')
134+
}
135+
123136
process.stdout.write(`\nDone!\n\nBuild and run your app with:\nssc build -r ${projectName}`)
124137
})

0 commit comments

Comments
 (0)