summaryrefslogtreecommitdiff
path: root/src/frontend/render/renderer.ts
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-03-30 15:06:43 -0400
committerGravatar GitHub <noreply@github.com> 2021-03-30 15:06:43 -0400
commit4a732837cdd1ad5493a25ae58612e9b6a302c651 (patch)
tree724af4f76202d6615a6969cd2d2bd7e3723c3d4f /src/frontend/render/renderer.ts
parent7334a550d8e042ae0dc59519149df2b3ad04f058 (diff)
downloadastro-4a732837cdd1ad5493a25ae58612e9b6a302c651.tar.gz
astro-4a732837cdd1ad5493a25ae58612e9b6a302c651.tar.zst
astro-4a732837cdd1ad5493a25ae58612e9b6a302c651.zip
Resolve component URLs during compilation (#40)
Previously dynamic component URLs were being resolved client-side in a weird way that only worked during dev. This change makes them handle during compilation, so it works in both (and improves readability of the dynamic import output).
Diffstat (limited to 'src/frontend/render/renderer.ts')
-rw-r--r--src/frontend/render/renderer.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/frontend/render/renderer.ts b/src/frontend/render/renderer.ts
index ceb460e40..d7afc0558 100644
--- a/src/frontend/render/renderer.ts
+++ b/src/frontend/render/renderer.ts
@@ -23,7 +23,7 @@ export function createRenderer(renderer: Renderer) {
return [...acc, `import("${context.frameworkUrls[lib as any]}")`];
}, [])
.join(',');
- return `const [{${context.componentExport}: Component}, ${values}] = await Promise.all([import(${context.componentUrl})${renderer.imports ? ', ' + libs : ''}]);`;
+ return `const [{${context.componentExport}: Component}, ${values}] = await Promise.all([import("${context.componentUrl}")${renderer.imports ? ', ' + libs : ''}]);`;
};
const serializeProps = (props: Record<string, any>) => JSON.stringify(props);
const createContext = () => {