webpack打包插件
const path = require('path'); //引入node的path模块
const webpack = require('webpack'); //引入的webpack,使用lodash
const HtmlWebpackPlugin = require('html-webpack-plugin') //将html打包
const ExtractTextPlugin = require('extract-text-webpack-plugin') //打包的css拆分,将一部分抽离出来
const CopyWebpackPlugin = require('copy-webpack-plugin')
// console.log(path.resolve(__dirname,'dist')); //物理地址拼接
优化打包速度
constUglifyJsPlugin= require('uglifyjs-webpack-plugin');
压缩代码,这里使用的是uglifyjs-webpack-plugin,同样在webpack.config.js的plugin里面添加
constUglifyJsPlugin= require('uglifyjs-webpack-plugin'); plugins:[ new UglifyJsPlugin({ uglifyOptions: { output: { beautify: false, comments: false, }, compress: { warnings: false, drop_debugger: true, drop_console: true, pure_funcs: ['console.log', '(e = console).log' ] }, sourceMap: false } }) ]
相关推荐
yezitoo 2020-06-06
不知道该写啥QAQ 2020-11-12
webfullStack 2020-11-09
Yvettre 2020-09-15
想做大牛的蜗牛 2020-10-30
gloria0 2020-10-26
gaojie0 2020-09-11
SelinaChan 2020-08-14
不知道该写啥QAQ 2020-08-09
gloria0 2020-08-09
不知道该写啥QAQ 2020-08-02
hline 2020-07-29
SelinaChan 2020-07-28
wangdianyong 2020-07-23
webpackvuees 2020-07-23
yqoxygen 2020-07-20
不知道该写啥QAQ 2020-07-18
waterv 2020-07-18