Skip to content

Commit

Permalink
fix(cli): added src file to involved list
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaufy committed Mar 18, 2019
1 parent ee07277 commit 5a3bd25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/cli/core/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ class Compile extends Hook {
chokidar.watch([this.options.src], watchOption).on('all', (evt, filepath) => {
if (evt === 'change') {
let absolutePath = path.resolve(filepath);
if (this.involved[absolutePath]) {
let involvedFile = this.involved[absolutePath];
if (path.isAbsolute(involvedFile)) {
this.compiled[involvedFile].hash = ''; // clear the file hash, to remove the file cache
}
if (involvedFile) {
this.logger.silly('watch', `Watcher triggered by file changes: ${absolutePath}`);
this.start();
}
Expand Down
1 change: 1 addition & 0 deletions packages/cli/core/plugins/parser/wpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ exports = module.exports = function () {
const request = loaderUtils.urlToRequest(src, src.charAt(0) === '/' ? '' : null);
tasks.push(this.resolvers.normal.resolve({}, dir, request, {}).then(rst => {
node.content = fs.readFileSync(rst.path, 'utf-8');
this.involved[rst.path] = context.file;
node.dirty = true;
}));
}
Expand Down

0 comments on commit 5a3bd25

Please sign in to comment.