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.

Compiling error when the template of the .vue file has the attribute lang="html"

See original GitHub issue

Version

15.2.6

Reproduction link

https://github.com/eltonchan/test_vue_loader

Steps to reproduce

1、use vue cli3 create application (vue cli3 default use 15 version for vue-loader) 2、add html-loader to webpapck Configuration

chainWebpack: (config) => {
        config.module
            .rule('html')
            .test(/\.html$/)
            .use('html-loader')
            .loader('html-loader')
            .end();
    },

3、.vue file template add lang=“html” attribute

<template lang="html">

4、npm run serve

What is expected?

compiling success

What is actually happening?

error in ./src/App.vue?vue&type=template&id=7ba5bd90&lang=html&

Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js): (Emitted value instead of an instance of Error) Error compiling template:


By the way, in 14 version No such problem。

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mgrinspancommented, Dec 25, 2018

Modify your package.json file to have "vue-loader": "<15.0.0" in the require section. Then run npm install

2reactions
adamgoosecommented, Dec 14, 2018

This proves problematic for a component that uses a language other than html. For example, we use pug for all of our vue component files.

I’m getting the same error, but also can see a message beneath the template:

error  in ./src/components/Presence.vue?vue&type=template&id=3482c7ab&lang=pug&

Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error)
  Error compiling template:

  v-toolbar-items(transition="slide-y-transition")
    v-avatar.mx-2.user-avatar(size="24" v-for="(id, i) in present" :key="i")
      img(:src="`https://someawesomeavatarserver.com/${id}`")

  - Component template requires a root element, rather than just text.

When I nest the entire component in a div, the compiler gives me the same error for another component, then another, then another…

It seems as though, in my case at least, the loader doesn’t recognize v-toolbar-items(...) as a root element.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error compiling template/ Error in mounted hook
First problem - template should contain exactly one root element. that ... handling in vue - https://v2.vuejs.org/v2/guide/events.html.
Read more >
Template Syntax | Vue.js
Under the hood, Vue compiles the templates into highly-optimized JavaScript code. ... The v-html attribute you're seeing is called a directive.
Read more >
Hide div outside of template in .vue file - Laracasts
I have and div outside my template that i want to hide during edit. this works: Copy Code <template lang="html"> <div v-show="create">create</div>.
Read more >
HTML page has lang attribute | ACT Rule | WAI - W3C
This rule checks that an HTML page has a non-empty lang attribute. ... methods than the lang attribute, for example using HTTP headers...
Read more >
App Internationalization (i18n) - Quasar Framework
The recommended package for handling website/app is vue-i18n . ... On the Boot File documentation page you can see a specific example for...
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