From 2c023899a2a20ab7098279c66e532681b573d4f9 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 28 Feb 2018 10:58:17 +0330 Subject: [PATCH] use time-fix-plugin --- lib/builder/builder.js | 3 ++- lib/builder/webpack/base.config.js | 4 +++- lib/builder/webpack/plugins/timefix.js | 18 ------------------ package.json | 22 ++++++++++++---------- yarn.lock | 4 ++++ 5 files changed, 21 insertions(+), 30 deletions(-) delete mode 100644 lib/builder/webpack/plugins/timefix.js diff --git a/lib/builder/builder.js b/lib/builder/builder.js index bcd5304a53..2b0fdf2a97 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -605,7 +605,8 @@ module.exports = class Builder { publicPath: this.options.build.publicPath, stats: this.webpackStats, logLevel: 'silent', - watchOptions: this.options.watchers.webpack + watchOptions: this.options.watchers.webpack, + watchOffset: 0 // Handled by time-fix-plugin }, this.options.build.devMiddleware ) diff --git a/lib/builder/webpack/base.config.js b/lib/builder/webpack/base.config.js index 24277caf56..d8ef761104 100644 --- a/lib/builder/webpack/base.config.js +++ b/lib/builder/webpack/base.config.js @@ -1,10 +1,12 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin') +const TimeFixPlugin = require('time-fix-plugin') const { cloneDeep } = require('lodash') const { join, resolve } = require('path') + const { isUrl, urlJoin } = require('../../common/utils') + const vueLoader = require('./vue-loader') const styleLoader = require('./style-loader') -const TimeFixPlugin = require('./plugins/timefix') const WarnFixPlugin = require('./plugins/warnfix') /* diff --git a/lib/builder/webpack/plugins/timefix.js b/lib/builder/webpack/plugins/timefix.js deleted file mode 100644 index 4bf8fd2854..0000000000 --- a/lib/builder/webpack/plugins/timefix.js +++ /dev/null @@ -1,18 +0,0 @@ -// Taken from https://github.com/egoist/poi/blob/3e93c88c520db2d20c25647415e6ae0d3de61145/packages/poi/lib/webpack/timefix-plugin.js#L1-L16 -// Thanks to @egoist -module.exports = class TimeFixPlugin { - constructor(timefix = 5000) { - this.timefix = timefix - } - - apply(compiler) { - compiler.hooks.watchRun.tap('timefix-plugin', (watching, callback) => { - watching.startTime += this.timefix - callback() - }) - - compiler.hooks.done.tap('timefix-plugin', stats => { - stats.startTime -= this.timefix - }) - } -} diff --git a/package.json b/package.json index 72e013e4ef..3192dbe50e 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ { "name": "nuxt", "version": "1.3.0", - "description": - "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", + "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "contributors": [ { "name": "Sebastien Chopin (@Atinux)" @@ -20,7 +19,10 @@ "type": "git", "url": "git+https://github.com/nuxt/nuxt.js" }, - "files": ["bin", "lib"], + "files": [ + "bin", + "lib" + ], "keywords": [ "nuxt", "nuxt.js", @@ -38,13 +40,13 @@ "nuxt": "./bin/nuxt" }, "nyc": { - "include": ["lib"] + "include": [ + "lib" + ] }, "scripts": { - "test": - "npm run lint && nyc ava --verbose test/ -- && nyc report --reporter=html", - "test-appveyor": - "npm run lint && nyc ava --serial test/ -- && nyc report --reporter=html", + "test": "npm run lint && nyc ava --verbose test/ -- && nyc report --reporter=html", + "test-appveyor": "npm run lint && nyc ava --serial test/ -- && nyc report --reporter=html", "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "eslint --ext .js,.vue bin/* build/ lib/ test/ examples/", "precommit": "npm run lint", @@ -102,6 +104,7 @@ "server-destroy": "^1.0.1", "source-map": "^0.7.0", "style-resources-loader": "^1.0.0", + "time-fix-plugin": "^2.0.0", "uglifyjs-webpack-plugin": "^1.2.2", "upath": "^1.0.2", "url-loader": "^0.6.2", @@ -150,7 +153,6 @@ "collective": { "type": "opencollective", "url": "https://opencollective.com/nuxtjs", - "logo": - "https://opencollective.com/nuxtjs/logo.txt?reverse=true&variant=variant2" + "logo": "https://opencollective.com/nuxtjs/logo.txt?reverse=true&variant=variant2" } } diff --git a/yarn.lock b/yarn.lock index f5514a2fd5..6433821b09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7319,6 +7319,10 @@ through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" +time-fix-plugin@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/time-fix-plugin/-/time-fix-plugin-2.0.0.tgz#d112f1e415b6ed269e008a42990ddbf8053fc315" + time-zone@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/time-zone/-/time-zone-1.0.0.tgz#99c5bf55958966af6d06d83bdf3800dc82faec5d"