webpack配置

1.npm init
2.{
  "name": "mettingwebpack",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack --mode development",
  },
  "author": "xxxx",
  "license": "ISC",
  "devDependencies": {
    "css-loader": "^3.4.2",
    "json5": "^2.1.1",
    "style-loader": "^1.1.3",
    "webpack": "^4.41.5"
  }
}
3.css loader
const path = require('path');

module.exports = {
    entry:'./src/main.js',
    output:{
        path:path.resolve(__dirname,'dist'),
        filename:'bundle.js'
    },
    module:{
        rules: [
            {
                test: /\.css$/i,
                use: ['style-loader', 'css-loader'],//下载依赖包
            },
        ],
    }
}

 

你可能感兴趣的:(Vue)