我已经克隆并安装了这个VueJs SSR应用程序(由Vuejs社区自己创建):
https://github.com/vuejs/vue-hackernews-2.0
我想将CSS预处理器从手写笔更改为Sass,因此我所做的是:
安装sass依赖项:
npm install -D sass-loader node-sass将规则添加到webpack配置(build/webpack.base.config.js):
rules: [
// ... other rules omitted
// this will apply to both plain `.scss` files
// AND `<style lang="scss">` blocks in `.vue` files
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
]
}
]当我运行npm run dev时,我得到了这个错误:
ERROR Failed to compile with 1 errors 5:54:17 PM
error in ./src/App.vue?vue&type=style&index=0&lang=scss&
Module parse failed: Unexpected token (13:5)
You may need an appropriate loader to handle this file type.
|
|
| body {
| background: #000
| }发布于 2019-09-03 22:30:33
根据official documentation的说法,你的vue-loader配置看起来很完美。然而,在你的CSS中你遗漏了一个分号,你必须改变这一点:
body {
background: #000
}对于这一条:
body {
background: #000;
}https://stackoverflow.com/questions/57760636
复制相似问题