Skip to content

Commit

Permalink
Read Babel's res.externalDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jun 19, 2022
1 parent 8c2ffaf commit 4d3f2af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flow-libs/babel-core.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ declare module "@babel/core" {
getModuleId?: (name: string) => string,
moduleRoot?: string,
|};
declare type Result = {| code: string, map: ?SourceMap, ast: File |};
declare type Result = {| code: string, map: ?SourceMap, ast: File, externalDependencies: Set<string> |};

declare export function transform(
code: string,
Expand Down
5 changes: 5 additions & 0 deletions packages/transformers/babel/src/babel7.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ export default async function babel7(
remapAstLocations(babelCore.types, res.ast, map);
}
}
if (res.externalDependencies) {
for (let f of res.externalDependencies) {
asset.invalidateOnFileChange(f);
}
}
}

if (res.ast) {
Expand Down

0 comments on commit 4d3f2af

Please sign in to comment.