From b77e379c9e85c61e1037cfed67c2c19daae54637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=B5=A9=E9=BA=9F?= Date: Sat, 14 Jul 2018 13:36:12 +0800 Subject: [PATCH] fix: TypeError: Cannot read property 'watchFileSystem' of undefined --- lib/WebPlugin.js | 5 ++--- package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/WebPlugin.js b/lib/WebPlugin.js index 33e100a..4ab2a74 100644 --- a/lib/WebPlugin.js +++ b/lib/WebPlugin.js @@ -86,15 +86,14 @@ class WebPlugin { // user may use Default template if (typeof options.template === 'string') { // watch for file changed event - compiler.hooks.watchRun.tap('WebPlugin', (watching, done) => { + compiler.hooks.watchRun.tap('WebPlugin', (watching) => { // 发生变化的文件列表 - const changedTimes = watching.compiler.watchFileSystem.watcher.mtimes; + const changedTimes = watching.watchFileSystem.watcher.mtimes; // 如果 HTML 模版文件发生了变化就重新编译模版文件 if (changedTimes[options.template] !== undefined) { // html template file has changed, re build this.htmlDocument this.buildHtmlDocument(); } - done(); }); // add html template file to file dependencies after compile, to let webpack watch html template file change and emit watch-run event diff --git a/package.json b/package.json index 1c8cc10..2f47802 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web-webpack-plugin", - "version": "4.0.0", + "version": "4.0.1", "description": "web plugin for webpack, alternatives for html-webpack-plugin, use HTML as entry", "keywords": [ "webpack",