Skip to content

Commit

Permalink
Throw an error when a file outside of the project is found
Browse files Browse the repository at this point in the history
  • Loading branch information
davazp committed Jun 4, 2019
1 parent 29b100d commit faf3c14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,16 @@ function successLoader(
instance
);

if (changedFilesList) {
if (changedFilesList && !instance.rootFileNames.has(filePath)) {
reloadRootFileNamesFromConfig(loaderContext, instance);
if (
!instance.rootFileNames.has(filePath) &&
!options.onlyCompileBundledFiles
) {
throw new Error(
`The file ${filePath} is not part of the project specified in tsconfig.json. Make sure it is covered by the fields 'include', 'exclude' and 'files'.`
);
}
}

const referencedProject = getAndCacheProjectReference(filePath, instance);
Expand Down

0 comments on commit faf3c14

Please sign in to comment.