Remove remote urls from import scanner (#256)

* fix: remove remote urls from import scanner

* debug test
This commit is contained in:
Nate Moore 2021-05-26 14:56:34 -05:00 committed by GitHub
parent 5dc3aa007a
commit be804499b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -248,7 +248,10 @@ export function findDeps(html: string, { astroConfig, srcPath }: { astroConfig:
if (!text) return; if (!text) return;
const [imports] = eslexer.parse(text); const [imports] = eslexer.parse(text);
for (const spec of imports) { for (const spec of imports) {
if (spec.n) pageDeps.js.add(spec.n); const importSrc = spec.n;
if (importSrc && !isRemote(importSrc)) {
pageDeps.js.add(getDistPath(importSrc, { astroConfig, srcPath }));
}
} }
} }
}); });

View file

@ -10,6 +10,7 @@ setupBuild(ComponentChildren, './fixtures/astro-children');
ComponentChildren('Passes string children to framework components', async ({ runtime }) => { ComponentChildren('Passes string children to framework components', async ({ runtime }) => {
let result = await runtime.load('/strings'); let result = await runtime.load('/strings');
console.log(JSON.stringify(result, null, 2));
if (result.error) throw new Error(result); if (result.error) throw new Error(result);
const $ = doc(result.contents); const $ = doc(result.contents);