Error compiling template:

来源:11-2 构建工具-2

至心

2018-07-23

ERROR in ./app/js/home/index.vue?vue&type=template&id=4c3b6c1c&lang=html& (./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/html-loader!./node_modules/vue-loader/lib??vue-loader-options!./app/js/home/index.vue?vue&type=template&id=4c3b6c1c&lang=html&)

Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):

(Emitted value instead of an instance of Error)

  Error compiling template:

  module.exports = "\n<div class=\"home\">\n    <h1>home</h1>\n</div>\n";

  - text "module.exports = "\n" outside root element will be ignored.


 @ ./app/js/home/index.vue?vue&type=template&id=4c3b6c1c&lang=html& 1:0-262 1:0-262

 @ ./app/js/home/index.vue

 @ ./app/js/router/index.js

 @ ./app/js/main.js

 @ multi (webpack)-dev-server/client?http://localhost:9000 ./app/js/main.js


ERROR in ./app/js/App.vue?vue&type=template&id=f3d8e912&lang=html& (./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/html-loader!./node_modules/vue-loader/lib??vue-loader-options!./app/js/App.vue?vue&type=template&id=f3d8e912&lang=html&)

Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):

(Emitted value instead of an instance of Error)

  Error compiling template:

  module.exports = "\n<div id=\"app\">\n    <router-view></router-view>\n</div>\n";

  - text "module.exports = "\n" outside root element will be ignored.


写回答

3回答

至心

提问者

2018-07-24

2
1
YRNH
我也是遇到了同样的问题,通过同学推荐的方法,去掉template的lang=“html”解决了问题,十分感谢。
2018-11-01
共1条回复

至心

提问者

2018-07-24

折磨了我两天的问题....就是你这个...

按这个GitHub上面有个回答, 我试了讲`<template lang="html">`改成了`<template>`. 同时, 我自己根据报错信息将`<style></style>`内部的内容全部干掉.

结果倒是可以正确看到页面.

但是, <style>中不能放内容怎么破?

//img.mukewang.com/szimg/5b55ff4900015b8a15180668.jpg



0
0

快乐动起来呀

2018-07-24

vue-loader按指定版本安装试试呢

0
1
至心
请问老师, 需要指定那个版本呢?
2018-07-24
共1条回复

前端面试项目冲刺 京东金融Vue组件化实战

透过京东金融项目理解组件化思维与项目面试,提升你的综合能力

922 学习 · 309 问题

查看课程