webpack优化
1,增加CleanWebpackPlugin插件,作用是,清空之前的dist文件夹,避免文件积攒
2,由于开发模式下会运行 HotModuleReplacementPlugin
所以在本地build的时,会针对生成的新的dist文件,这样就触发了热更新并自动运行babel-loader,而babel-loader会生成新的转码文件,会使得dist文件夹下面增加不必要的转码文件。
此时需要在babel-loader里面增加exclude字段,不再转码dist文件夹
{ test: /\.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test')], exclude: /dist/, // 不再转码dist文件夹 options: { cacheDirectory:true } },
相关推荐
PANH 2020-01-23
PANH 2019-10-28
zhongweinan 2019-09-08
Fairfeng 2019-09-08
lbn0 2019-09-08
86530296 2020-11-10
hilary0 2020-02-21
83096129 2020-01-08
fangjack 2020-01-01
Justypc 2013-03-29
shyoushine 2019-11-10
cherayliu 2019-11-04
Wmeng0 2018-08-17
CWeeYii 2008-09-17
王之白石 2014-10-26
欧阳凯少 2015-08-26
gaedmihx 2019-04-17
ningningmingming 2016-08-16