标签:err depend require config conf filename word src load
环境
node + webpack4.0 + webpack-cli + style-loader css-loader
文件结构
│ 1.png │ package.json │ webpack.config.js │ └─src │ app.js │ └─css t.css
package.json(依赖)
{ "name": "loader", "version": "1.0.0", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "css-loader": "^2.1.1", "style-loader": "^0.23.1", "webpack": "^4.33.0", "webpack-cli": "^3.3.3" } }
打包webpack配置
loader顺序必须是 style-css 再到 css-loader
file-loader
url-loader
const path = require(‘path‘); module.exports = { entry: { app: ‘./src/app.js‘ }, output: { filename: "bundle.js", path: path.join(path.resolve(__dirname), ‘dist‘) }, mode: "development", module: { rules: [ { test: /\.js$/, exclude: ‘/node_modules/‘, }, { test: /\.css$/, use: ["style-loader", "css-loader"] } ] } };
标签:err depend require config conf filename word src load
原文地址:https://www.cnblogs.com/heidekeyi/p/10990357.html