Skip to content

Commit 2968fd9

Browse files
davidturnbullclaude
andcommitted
refactor: use withLingo pattern in vite config
Extract Lingo compiler configuration to withLingo function following the AdonisJS example. Keep defineConfig since it's needed for the Sentry integration that uses the config parameter. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent e313640 commit 2968fd9

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

demo/the-epic-stack/vite.config.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ const viteConfig: UserConfig = {
8383
},
8484
}
8585

86+
const withLingo = lingoCompiler.vite({
87+
sourceRoot: 'app',
88+
lingoDir: 'lingo',
89+
sourceLocale: 'en',
90+
targetLocales: ['es'],
91+
rsc: false,
92+
useDirective: false,
93+
debug: false,
94+
models: 'lingo.dev',
95+
})
96+
8697
export default defineConfig((config) => {
8798
const configWithSentry = {
8899
...viteConfig,
@@ -94,14 +105,5 @@ export default defineConfig((config) => {
94105
].filter(Boolean),
95106
}
96107

97-
return lingoCompiler.vite({
98-
sourceRoot: 'app',
99-
lingoDir: 'lingo',
100-
sourceLocale: 'en',
101-
targetLocales: ['es'],
102-
rsc: false,
103-
useDirective: false,
104-
debug: false,
105-
models: 'lingo.dev',
106-
})(configWithSentry)
108+
return withLingo(configWithSentry)
107109
})

0 commit comments

Comments
 (0)