@@ -6,7 +6,7 @@ import * as crypto from "crypto";
66import * as sfc from '@vue/compiler-sfc' ;
77
88import { loadRules , replaceRules } from "./paths" ;
9- import { fileExists , getFullPath , getUrlParams } from "./utils"
9+ import { fileExists , getFullPath , getUrlParams , tryAsync } from "./utils"
1010import { Options } from "./options" ;
1111import { generateIndexHTML } from "./html" ;
1212
@@ -135,7 +135,8 @@ const vuePlugin = (opts: Options = {}) => <esbuild.Plugin>{
135135 let source = descriptor . template . content ;
136136
137137 if ( descriptor . template . lang === "pug" ) {
138- source = ( await import ( "pug" ) ) . render ( descriptor . template . content ) ;
138+ const pug = await tryAsync ( ( ) => import ( "pug" ) , "pug" , "Pug template rendering" )
139+ source = pug . render ( descriptor . template . content ) ;
139140
140141 // Fix #default="#default" and v-else="v-else"
141142 source = source . replace ( / ( \B # .* ?| \b v - .* ?) = " \1" / g, "$1" ) ;
@@ -163,8 +164,8 @@ const vuePlugin = (opts: Options = {}) => <esbuild.Plugin>{
163164 let includedFiles : string [ ] = [ ] ;
164165
165166 if ( style . lang === "sass" || style . lang === "scss" ) {
166- const sass = await import ( "sass" ) ;
167-
167+ const sass = await tryAsync ( ( ) => import ( "sass" ) , "sass" , "SASS style preprocessing ") ;
168+
168169 const result : import ( "sass" ) . Result = await new Promise ( ( resolve , reject ) => sass . render ( {
169170 data : source ,
170171 indentedSyntax : style . lang === "sass" ,
0 commit comments