diff --git a/lib/build.js b/lib/build.js index 64b79d3675..6c99b1c965 100644 --- a/lib/build.js +++ b/lib/build.js @@ -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