Skip to content

Commit 810fe4d

Browse files
committed
wip: default mode for compat build
1 parent c5c304a commit 810fe4d

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

packages/runtime-core/src/compat/compatConfig.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,9 @@ export type CompatConfig = Partial<
456456
MODE?: 2 | 3
457457
}
458458

459-
export const globalCompatConfig: CompatConfig = {}
459+
export const globalCompatConfig: CompatConfig = {
460+
MODE: 2
461+
}
460462

461463
export function configureCompat(config: CompatConfig) {
462464
if (__DEV__) {

packages/vue-compat/src/index.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,17 @@ function compileToFunction(
5555
extend(
5656
{
5757
hoistStatic: true,
58-
onError(err) {
59-
if (__DEV__) {
60-
onError(err)
61-
} else {
62-
/* istanbul ignore next */
63-
throw err
64-
}
65-
},
66-
onWarn: __DEV__ ? onError : NOOP
58+
onError: __DEV__ ? onError : undefined,
59+
onWarn: __DEV__ ? e => onError(e, true) : NOOP
6760
} as CompilerOptions,
6861
options
6962
)
7063
)
7164

72-
function onError(err: CompilerError) {
73-
const message = `Template compilation error: ${err.message}`
65+
function onError(err: CompilerError, asWarning = false) {
66+
const message = asWarning
67+
? err.message
68+
: `Template compilation error: ${err.message}`
7469
const codeFrame =
7570
err.loc &&
7671
generateCodeFrame(

packages/vue/src/index.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,17 @@ function compileToFunction(
4949
extend(
5050
{
5151
hoistStatic: true,
52-
onError(err) {
53-
if (__DEV__) {
54-
onError(err)
55-
} else {
56-
/* istanbul ignore next */
57-
throw err
58-
}
59-
},
60-
onWarn: __DEV__ ? onError : NOOP
52+
onError: __DEV__ ? onError : undefined,
53+
onWarn: __DEV__ ? e => onError(e, true) : NOOP
6154
} as CompilerOptions,
6255
options
6356
)
6457
)
6558

66-
function onError(err: CompilerError) {
67-
const message = `Template compilation error: ${err.message}`
59+
function onError(err: CompilerError, asWarning = false) {
60+
const message = asWarning
61+
? err.message
62+
: `Template compilation error: ${err.message}`
6863
const codeFrame =
6964
err.loc &&
7065
generateCodeFrame(

0 commit comments

Comments
 (0)