8000 fix(listview): only require tns module at runtime · brysem/nativescript-vue@4c00885 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c00885

Browse files
committed
fix(listview): only require tns module at runtime
the template compiler needs to be able to run in a node environment (webpack), so we need to make sure to not rely on tns modules directly, and only require them in runtime contexts
1 parent 91dfadf commit 4c00885

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

platform/nativescript/runtime/components/list-view.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { VUE_VIEW } from './v-template'
22
import { extend } from 'shared/util'
3-
import { ObservableArray } from 'tns-core-modules/data/observable-array'
43

54
export default {
65
props: {
76
items: {
87
type: Object,
9-
validator: val => Array.isArray(val) || val instanceof ObservableArray,
8+
validator: val => {
9+
const ObservableArray = require('tns-core-modules/data/observable-array')
10+
return Array.isArray(val) || val instanceof ObservableArray
11+
},
1012
required: true
1113
},
1214
'+alias': {

0 commit comments

Comments
 (0)
0