報錯說需要對應(yīng)的
loader
來處理這類文件, 事實上, 已經(jīng)安裝有對應(yīng)的loader
, 且在webpack.config.js
中有正確配置的.
環(huán)境
- webpack-dev-server@3.1.5
- webpack@4.16.1
- vue-loader@15.2.6
我按照GitHub的方法, 將<template lang="html">
中的lang="html"
刪除. 同時, 刪除了style
中內(nèi)容. 可以編譯成功.
接下來解決, 怎么讓其識別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"
了!