mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Handle undefined assets when combining. (#1569)
It's possible for common.js to be empty in certain cases. So, we need to handle it.
This commit is contained in:
parent
4a069e9d93
commit
bd80b78f5d
|
@ -11,7 +11,10 @@ export default class CombineAssetsPlugin {
|
||||||
compiler.plugin('after-compile', (compilation, callback) => {
|
compiler.plugin('after-compile', (compilation, callback) => {
|
||||||
let newSource = ''
|
let newSource = ''
|
||||||
this.input.forEach((name) => {
|
this.input.forEach((name) => {
|
||||||
newSource += `${compilation.assets[name].source()}\n`
|
const asset = compilation.assets[name]
|
||||||
|
if (!asset) return
|
||||||
|
|
||||||
|
newSource += `${asset.source()}\n`
|
||||||
delete compilation.assets[name]
|
delete compilation.assets[name]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue