From 7e698f1613cd8f861f11a90cb8156a246e356561 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 28 Aug 2018 18:06:26 -0400 Subject: [PATCH] use watchChange plugin hook to detect invalidations --- src/core/create_compilers.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/create_compilers.ts b/src/core/create_compilers.ts index 8e25432..0013a9a 100644 --- a/src/core/create_compilers.ts +++ b/src/core/create_compilers.ts @@ -105,6 +105,13 @@ export class RollupCompiler { const mod: any = require(input); delete require.cache[input]; + (mod.plugins || (mod.plugins = [])).push({ + name: 'sapper-internal', + watchChange: (file: string) => { + this._oninvalid(file); + } + }); + return mod; } @@ -147,8 +154,6 @@ export class RollupCompiler { case 'BUNDLE_START': this._start = Date.now(); - // TODO figure out which file changed - this._oninvalid('[TODO] unknown file'); break; case 'BUNDLE_END':