A. L
A. L

Reputation: 12649

nuxt unclear warnings of undefined variable

So this was largely a test. In normal Vue, you'd get the line number of where the error went wrong, but it seems like Nuxt is quite general about that, and just tells you the file only, without the line number. Is it possible to add it back in with some settings?

I just have a simple page set up:

pages/example.vue

<template>
    <div>
        I am example {{ something }}
        <nuxt-child/>
    </div>
</template>

warning:

[Vue warn]: Property or method "something" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <Pages/example.vue> at pages/example.vue
       <Nuxt>
         <Layouts/default.vue> at layouts/default.vue
           <Root>

Upvotes: 1

Views: 382

Answers (1)

Decade Moon
Decade Moon

Reputation: 34286

It's not possible to get the line number from this warning message.

The Vue template compiler does not generate source maps, so it would be impossible to get the original line number.

Looks like it is planned for v3, though.

Upvotes: 2

Related Questions