Skip to content

Commit 89e7900

Browse files
committed
fix: should not crash when prettier failed
1 parent b470391 commit 89e7900

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/compileTemplate.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,18 @@ function actuallyCompile(
170170
code += `render._withStripped = true`
171171

172172
if (prettify) {
173-
code = require('prettier').format(code, {
174-
semi: false,
175-
parser: 'babel'
176-
})
173+
try {
174+
code = require('prettier').format(code, {
175+
semi: false,
176+
parser: 'babel'
177+
})
178+
} catch (e) {
179+
tips.push(
180+
`Failed to prettify component ${
181+
options.filename
182+
} template source after compilation.`
183+
)
184+
}
177185
}
178186
}
179187

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy