Nói chúng để nhúng css vào js thì chỉ cần
Copy 'style-loader', 'css-loader'
Copy var path = require("path");
module.exports = {
mode: 'development',
entry: [
'./src/index.js'
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
},
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
}
],
},
};
Copy {
"name": "webpack",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"start": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^8.1.0",
"babel-preset-env": "^1.7.0",
"css-loader": "^4.3.0",
"style-loader": "^1.2.1",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"mini-css-extract-plugin": "^0.11.2"
}
}
Copy ul {
list-style: none;
}
ul li {
display: inline-block; margin: 0 10px;
}
ul li a {
color: #377ab7; text-decoration: none;
}
ul li a:hover {
color: red;
}