Fix webpack building loop

This commit is contained in:
Sébastien Chopin 2017-03-25 03:17:26 +01:00
parent 019d00fadb
commit 7a34763277

View File

@ -16,6 +16,7 @@ import serverWebpackConfig from './webpack/server.config.js'
const debug = require('debug')('nuxt:build')
const remove = pify(fs.remove)
const readFile = pify(fs.readFile)
const utimes = pify(fs.utimes)
const writeFile = pify(fs.writeFile)
const mkdirp = pify(fs.mkdirp)
const glob = pify(require('glob'))
@ -243,7 +244,13 @@ function * generateRoutesAndFiles () {
}
})
const content = template(templateVars)
return writeFile(r(this.dir, '.nuxt', file), content, 'utf8')
const path = r(this.dir, '.nuxt', file)
return writeFile(path, content, 'utf8')
.then(() => {
// Fix webpack loop (https://github.com/webpack/watchpack/issues/25#issuecomment-287789288)
const dateFS = Date.now() / 1000 - 10
return utimes(path, dateFS, dateFS)
})
})
})
yield moveTemplates