Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

feat(run-build-update): handle linked npm modules #375

Merged
merged 1 commit into from
Nov 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ export function runBuildUpdate(context: BuildContext, changedFiles: ChangedFile[
changedFiles: changedFiles.map(f => f.filePath)
};

const jsFiles = changedFiles.filter(f => f.ext === '.js');
if (jsFiles.length) {
// this is mainly for linked modules
// if a linked library has changed (which would have a js extention)
// we should do a full transpile build because of this
context.bundleState = BuildState.RequiresUpdate;
}

const tsFiles = changedFiles.filter(f => f.ext === '.ts');
if (tsFiles.length > 1) {
// multiple .ts file changes
Expand Down Expand Up @@ -274,7 +282,7 @@ export function runBuildUpdate(context: BuildContext, changedFiles: ChangedFile[
}

// guess which file is probably the most important here
data.filePath = tsFiles.concat(sassFiles, htmlFiles)[0].filePath;
data.filePath = tsFiles.concat(sassFiles, htmlFiles, jsFiles)[0].filePath;

return data;
}
Expand Down