wip: default mode for compat build

This commit is contained in:
Evan You
2021-04-17 16:05:27 -04:00
parent c5c304af14
commit 810fe4d583
3 changed files with 15 additions and 23 deletions

View File

@@ -55,22 +55,17 @@ function compileToFunction(
extend(
{
hoistStatic: true,
onError(err) {
if (__DEV__) {
onError(err)
} else {
/* istanbul ignore next */
throw err
}
},
onWarn: __DEV__ ? onError : NOOP
onError: __DEV__ ? onError : undefined,
onWarn: __DEV__ ? e => onError(e, true) : NOOP
} as CompilerOptions,
options
)
)
function onError(err: CompilerError) {
const message = `Template compilation error: ${err.message}`
function onError(err: CompilerError, asWarning = false) {
const message = asWarning
? err.message
: `Template compilation error: ${err.message}`
const codeFrame =
err.loc &&
generateCodeFrame(