Skip to content

Commit 8da988d

Browse files
committed
fix: let $lux exist when enabled: false
1 parent b57106f commit 8da988d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/templates/plugin.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ export default function (ctx, inject) {
1414
let ignoreLUX = false
1515
let isFirstHit = null
1616

17-
if (!options.enabled) { return }
18-
1917
ctx.$lux = {
2018
// If logFirstHit is true, then let LUX log the first hit and ignore it if user tries to do it themselves
2119
pageLoading(isLoading = true) {
@@ -68,16 +66,17 @@ export default function (ctx, inject) {
6866
}
6967

7068
// client side setup the auto starter if requested
71-
if (process.client) {
69+
if (process.client && options.enabled) {
7270
ctx.app.router.beforeEach((to, from, next) => {
7371
isFirstHit = (isFirstHit === null)
7472

7573
ctx.$lux.routerBeforeEach(to, from)
7674
next()
7775
})
76+
7877
}
7978
// server side, inject the native LUX code on the fly
80-
else if (options.id) {
79+
else if (options.id && options.enabled) {
8180
ctx.beforeNuxtRender(() => {
8281
const head = ctx.app.head
8382

0 commit comments

Comments
 (0)