1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Unlink only pages bundle in dev env (#4015)

* Unlink only pages bundle in dev env

* Use IS_BUNDLED_PAGE regexp for unlink file plugin
This commit is contained in:
Tomáš Witek 2018-03-15 17:34:17 +01:00 committed by Arunoda Susiripala
parent f0308687c1
commit c73f7d6ace

View file

@ -1,5 +1,6 @@
import { join } from 'path'
import { unlink } from 'mz/fs'
import { IS_BUNDLED_PAGE } from '../../utils'
export default class UnlinkFilePlugin {
constructor () {
@ -9,7 +10,7 @@ export default class UnlinkFilePlugin {
apply (compiler) {
compiler.plugin('after-emit', (compilation, callback) => {
const removed = Object.keys(this.prevAssets)
.filter((a) => !compilation.assets[a])
.filter((a) => IS_BUNDLED_PAGE.test(a) && !compilation.assets[a])
this.prevAssets = compilation.assets