Skip to content

Commit 1911fdf

Browse files
committed
add env check before warning
1 parent 7e7e4e3 commit 1911fdf

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/data.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ export function collectDataFromConstructor (vm: Vue, Component: VueClass) {
2525
}
2626
})
2727

28-
if (!(Component.prototype instanceof Vue) && Object.keys(plainData).length > 0) {
29-
warn(
30-
'Component class must inherit Vue or its descendant class ' +
31-
'when class property is used.'
32-
)
28+
if (process.env.NODE_ENV !== 'production') {
29+
if (!(Component.prototype instanceof Vue) && Object.keys(plainData).length > 0) {
30+
warn(
31+
'Component class must inherit Vue or its descendant class ' +
32+
'when class property is used.'
33+
)
34+
}
3335
}
3436

3537
return plainData

src/globals.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* global type declarations in this project
3+
* should not expose to userland
4+
*/
5+
6+
declare const process: {
7+
env: {
8+
NODE_ENV: string
9+
}
10+
}

0 commit comments

Comments
 (0)