Error compiling template: You ma
2018-07-24 本文已影响0人
Nisus_Liu
报错说需要对应的
loader
来处理这类文件, 事实上, 已经安装有对应的loader
, 且在webpack.config.js
中有正确配置的.
环境
- webpack-dev-server@3.1.5
- webpack@4.16.1
- vue-loader@15.2.6
我按照GitHub的方法, 将<template lang="html">
中的lang="html"
删除. 同时, 删除了style
中内容. 可以编译成功.
接下来解决, 怎么让其识别style?
Try 1:
1532363965683.png==> 报没有node-sass模块
==> 安装npm install node-sass --no-optional
==>
成功!
[图片上传失败...(image-dad46b-1532365399855)]
Try 2:
//try: 解决style编译问题 failed , 还是得加 lang="scss"
options: {
loaders: {
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this necessary.
'scss': 'vue-style-loader!css-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
// other vue-loader options go here
}
看来, 还是得lang="scss"
了!