question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

templateInterpolationService does not work in Nuxt projects

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Linux
  • Vetur version: 0.22.3
  • VS Code version: 1.38.1

Problem

I set “vetur.experimental.templateInterpolationService” to true in my settings. Interpolation does not work on vue template inside a Nuxt projet. It however works in a standart Vue project.

Reproducible Case

  • npx create-nuxt-app test and choose all default with jsconfig enabled
  • Replace pages/index.vue text by:
<template>
  <v-layout>
    <p>{{ helloWorld }}</p>
  </v-layout>
</template>

<script>
export default {
  name: 'Accueil',
  data() {
    return {
      helloWorld: 'test'
    }
  },
  head() {
    return {
      title: 'Accueil'
    }
  }
}
</script>
  • Now the interpolation doesn’t work, it is probably due to custom methods used by nuxt such as head().

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
ktsncommented, Sep 16, 2019

Yes, your assumption is correct. Since template interpolation service uses TypeScript type of Vue component, it needs to be properly typed. You should install @nuxt/types and read it in jsconfig.json.

{
  "include": [
    "./src/**/*",
    "./node_modules/@nuxt/types/index.d.ts"
  ]
}
1reaction
rchlcommented, Sep 18, 2019

That’s the restriction of TypeScript and the current Vue’s typing.

Well, then I guess there is no bug here.

In any cases, the composition API in Vue v3 will get rid of this problem

Personally I do plan to switch to TS eventually but this is about JS + JSDoc annotations. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve "Property does not exist on type 'Vue'" error
I found this had an odd effect. Sometimes it worked, i.e. the VS Code error messages disappeared; and other times it didn't, they...
Read more >
Setup | Vetur - GitHub Pages
# Project Setup · package.json must exist in the project root, Vetur uses it to determine the installed Vue version. · Next, create...
Read more >
Creating Server-side Rendered Vue.js Apps Using Nuxt.js
There we go. Open your browser to localhost:3000 and your project should be running. Not much different from creating a Vue Webpack project....
Read more >
Class Components with JSX in NuxtJS - Damir's Corner
There are downsides to it, though. Although JSX is officially supported in Vue.js, it won't necessarily work out-of-the-box in all frameworks ...
Read more >
Really typing Vue
inb4: This is not another “setting up” a new project with Vue and ... We have this wonderful template with Nuxt , Vue...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found