2020-03-25

webpack笔记

process.cwd() // 当前工作目录,就是执行代码前cd到到的那个目录
__dirname: // 当前文件所在的目录
path.resolve(__dirname, 'build')

plugin

html-webpack-plugin

clean-webpack-plugin

用法有小改动

const { CleanWebpackPlugin } = require("clean-webpack-plugin");
modules.exports = {
  plugins: [
    new CleanWebpackPlugin(),
  ]
}

loaders

css:

css-loader
style-loader
less-loader

图片

url-loader
file-loader

js

babel-loader

resolve

devServer

{
port: 3000,
progress: true,
contentBase: './build'

}

output

devtool: 'eval-source-map',

常用插件

你可能感兴趣的:(2020-03-25)