9d538357446b8ef4ec69eeeb043c529dbdc251c5cd57d15aae2ad1c3af346e7a924ba5efb0fc4d76fab2f594ebab4331d62c767084b591bd441b8a786b4312 330 B

12345678910111213141516
  1. const fs = require('fs-extra')
  2. module.exports = class MovePlugin {
  3. constructor (from, to) {
  4. this.from = from
  5. this.to = to
  6. }
  7. apply (compiler) {
  8. compiler.hooks.done.tap('move-plugin', () => {
  9. if (fs.existsSync(this.from)) {
  10. fs.moveSync(this.from, this.to, { overwrite: true })
  11. }
  12. })
  13. }
  14. }