简体   繁体   English

webpack和CleanWebpackPlugin似乎在启动和每次保存时删除output.path而不是仅删除初始时间

[英]webpack and CleanWebpackPlugin seem to delete output.path on start and every save instead of initial time only

After updating to webpack 3.10.0 and clean-webpack-plugin to 2.0.1 then updating webpack.js config to use cleanOnceBeforeBuildPatterns . 更新到webpack 3.10.0和clean-webpack-plugin到2.0.1后,更新webpack.js配置以使用cleanOnceBeforeBuildPatterns Output.path get cleaned up on every save instead of only once during initial run. Output.path在每次保存时清理,而不是在初始运行期间清理一次。

webpack.js webpack.js

output: {
    filename: 'js/[name].bundle.js',
    path: path.resolve(__dirname, '..', '.tmp', 'public')
  },
...
plugins: [
    new ExtractTextPlugin('styles/[name].bundle.css'),

    new CleanWebpackPlugin({
      cleanOnceBeforeBuildPatterns: [path.resolve(__dirname, '..', '.tmp')],
      verbose: true,
      dry: false
    }),

I wonder, it doesnt like path.resolve? 我想知道,它不喜欢path.resolve?

I have reached out to the extension author, and the simple fix was to add folders to .tmp dir to ignore. 我已经联系了扩展作者,简单的解决方法是将文件夹添加到.tmp目录以忽略。

new CleanWebpackPlugin({
      cleanOnceBeforeBuildPatterns: [path.resolve(__dirname, '..', '.tmp')],
      cleanAfterEveryBuildPatterns: ['!images/**/*', '!fonts/**/*'],
      verbose: true,
      dry: false
    })

,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM