Skip to content

Commit

Permalink
fix: ensure imports are resolved in the right order
Browse files Browse the repository at this point in the history
  • Loading branch information
juliendargelos committed Dec 15, 2021
1 parent 974a7d6 commit 78c2b33
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ export function loader(
): Transform {
return (source: string) => {
return bundle(source, [...(source.match(PRAGMA) || []).map((pragma) => {
const pattern = new RegExp(`^${pragma}$`, 'm')
const loaded = load(pragma.replace(PRAGMA, '$1'), base, [], ignore)
return async (source: string) => source.replace(pattern, await loaded)
return async (source: string) => source.replace(
new RegExp(`^${pragma}$`, 'm'),
await load(pragma.replace(PRAGMA, '$1'), base, [], ignore)
)
}), ...transforms])
}
}
Expand Down

0 comments on commit 78c2b33

Please sign in to comment.