Skip to content

Commit 3f03251

Browse files
vchimevrigor789
authored andcommitted
fix: import application module (#512)
Ensure `application` module is loaded before overriding `global.__onLiveSyncCore`. Fixes NativeScript/nativescript-dev-webpack#943.
1 parent 8b51caa commit 3f03251

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

platform/nativescript/runtime/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Ensure `application` module is loaded
2+
// before overriding `global.__onLiveSyncCore`
3+
import { run, on, launchEvent } from 'tns-core-modules/application'
14
import { warn } from 'core/util/index'
25
import { patch } from './patch'
36
import { mountComponent } from 'core/instance/lifecycle'
@@ -50,7 +53,6 @@ Vue.prototype.$mount = function(el, hydrating) {
5053
}
5154

5255
Vue.prototype.$start = function() {
53-
const application = require('tns-core-modules/application')
5456
let self = this
5557
const AppConstructor = Vue.extend(this.$options)
5658

@@ -59,7 +61,7 @@ Vue.prototype.$start = function() {
5961
Vue.component(entry.meta.component.name, entry.meta.component)
6062
})
6163

62-
application.on(application.launchEvent, args => {
64+
on(launchEvent, args => {
6365
if (self.$el) {
6466
self.$destroy()
6567
self = new AppConstructor()
@@ -69,7 +71,7 @@ Vue.prototype.$start = function() {
6971
args.root = self.$el.nativeView
7072
})
7173

72-
application.run()
74+
run()
7375
}
7476

7577
// Define a `nativeView` getter in every NS vue instance

0 commit comments

Comments
 (0)