Skip to content

Commit c39683a

Browse files
committed
fix: do not fail preview builds when lunaria fails
1 parent 96e7c71 commit c39683a

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

modules/lunaria.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,17 @@ export default defineNuxtModule({
2727
if (!isCI || !existsSync(lunariaDistPath)) {
2828
mkdirSync(lunariaDistPath, { recursive: true })
2929
nuxt.hook('nitro:build:before', async () => {
30-
execSync('node --experimental-transform-types ./lunaria/lunaria.ts', {
31-
cwd: nuxt.options.rootDir,
32-
})
30+
try {
31+
execSync('node --experimental-transform-types ./lunaria/lunaria.ts', {
32+
cwd: nuxt.options.rootDir,
33+
})
34+
} catch (e) {
35+
// do not throw when building for staging
36+
const env = process.env.VERCEL_ENV
37+
if (!isCI || (env && env === 'production')) {
38+
throw e
39+
}
40+
}
3341
})
3442
}
3543
},

0 commit comments

Comments
 (0)