summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-04-19 16:13:53 -0400
committerGravatar GitHub <noreply@github.com> 2021-04-19 16:13:53 -0400
commitcc1a318c415fddfe1afd0c526e52ff112c5dd1b2 (patch)
treed46e8dcfb2498808b1df961c1f0cce0ee566ea99 /src
parentb25d2cc93e6a661f329ad6d8d3a595adc06cee1c (diff)
downloadastro-cc1a318c415fddfe1afd0c526e52ff112c5dd1b2.tar.gz
astro-cc1a318c415fddfe1afd0c526e52ff112c5dd1b2.tar.zst
astro-cc1a318c415fddfe1afd0c526e52ff112c5dd1b2.zip
Fix building of dynamic Svelte components (#115)
Svelte component resolution wasn't handled correctly during the build. Note that in the future we need to consolidate a "framework" API, so this stuff is not sprinkled throughout the codebase.
Diffstat (limited to 'src')
-rw-r--r--src/build.ts9
-rw-r--r--src/build/bundle.ts4
2 files changed, 12 insertions, 1 deletions
diff --git a/src/build.ts b/src/build.ts
index 93314da7a..219c36919 100644
--- a/src/build.ts
+++ b/src/build.ts
@@ -181,6 +181,7 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
);
} catch (err) {
error(logging, 'generate', err);
+ await runtime.shutdown();
return 1;
}
@@ -189,7 +190,13 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
}
if (imports.size > 0) {
- await bundle(imports, { dist, runtime, astroConfig });
+ try {
+ await bundle(imports, { dist, runtime, astroConfig });
+ } catch(err) {
+ error(logging, 'generate', err);
+ await runtime.shutdown();
+ return 1;
+ }
}
for (let url of statics) {
diff --git a/src/build/bundle.ts b/src/build/bundle.ts
index 681bea3b2..49d8b6686 100644
--- a/src/build/bundle.ts
+++ b/src/build/bundle.ts
@@ -173,6 +173,10 @@ export async function collectDynamicImports(filename: URL, { astroConfig, loggin
rel = rel.replace(/\.[^.]+$/, '.vue.js');
break;
}
+ case 'svelte': {
+ rel = rel.replace(/\.[^.]+$/, '.svelte.js');
+ break;
+ }
}
imports.add(`/_astro/${rel}`);