如何解决如何使用Webpack 4从多个SCSS文件制作一个CSS文件?
如果有人可以帮助... 我想在“ dist”文件夹中创建一个单独的css文件(style.css)。 我设法得到了捆绑,但它会自动将css文件导入
这是我的webpack.config.js
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./src/js/index.js",output: {
filename: "bundle.js",path: path.resolve(__dirname,"dist"),},devServer: {
contentBase: "./dist",plugins: [
new HtmlWebpackPlugin({
filename: "index.html",template: "./src/index.html",}),],module: {
rules: [
{
test: /\.s[ac]ss$/i,use: ["style-loader","css-loader","sass-loader"],};
这是package.json
{
"name": "try-out","version": "1.0.0","description": "","main": "index.js","scripts": {
"dev": "webpack --mode development","build": "webpack --mode production","start": "webpack-dev-server --mode development --open"
},"author": "","license": "ISC","devDependencies": {
"html-webpack-plugin": "^4.4.1","node-sass": "^4.14.1","sass": "^1.26.10","sass-loader": "^10.0.2","webpack": "^4.44.1","webpack-cli": "^3.3.12","webpack-dev-server": "^3.11.0"
},"dependencies": {
"css-loader": "^4.3.0","style-loader": "^1.2.1"
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。