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:
parent
f0308687c1
commit
c73f7d6ace
|
@ -1,5 +1,6 @@
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { unlink } from 'mz/fs'
|
import { unlink } from 'mz/fs'
|
||||||
|
import { IS_BUNDLED_PAGE } from '../../utils'
|
||||||
|
|
||||||
export default class UnlinkFilePlugin {
|
export default class UnlinkFilePlugin {
|
||||||
constructor () {
|
constructor () {
|
||||||
|
@ -9,7 +10,7 @@ export default class UnlinkFilePlugin {
|
||||||
apply (compiler) {
|
apply (compiler) {
|
||||||
compiler.plugin('after-emit', (compilation, callback) => {
|
compiler.plugin('after-emit', (compilation, callback) => {
|
||||||
const removed = Object.keys(this.prevAssets)
|
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
|
this.prevAssets = compilation.assets
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue