成功搭建的webpack和sass的配置,实现了实时更新css文件,然后愉快的使用sass编写样式。
正在完成编辑公告功能,目前能获取res.data但是无法赋值给富文本,正在查看文档看看能不能寻求帮助。
贴一下webpack的配置和package.json文件
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: {
index: './src/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'), //绝对路径
filename: '[name].js' //chunkhash避免重名
},
plugins: [
new MiniCssExtractPlugin({
filename: 'css/[name].css',
chunkFilename: 'css/[id].css',
})
],
module: {
rules: [{
test: /\.(sc|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
]
}]
},
}
{
"name": "webpack",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "webpack -d --progress --color --display-modules --display-reasons --display-error-details",
"dev": "webpack --watch -d --progress --color --display-modules --display-reasons",
"prod": "webpack --watch --progress --color --display-modules --display-reasons --p"
},
"license": "MIT",
"devDependencies": {
"css-loader": "^2.1.1",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
}
}
网友评论