diff --git a/packages/astro/src/core/render/dev/css.ts b/packages/astro/src/core/render/dev/css.ts index 657289d36cbad..8310b58dd344d 100644 --- a/packages/astro/src/core/render/dev/css.ts +++ b/packages/astro/src/core/render/dev/css.ts @@ -70,8 +70,11 @@ export async function getStylesForURL( if ( mode === 'development' && // only inline in development typeof importedModule.ssrModule?.default === 'string' // ignore JS module styles - ) { - importedStylesMap.set(importedModule.url, importedModule.ssrModule.default); + ) { + const styles = importedModule.ssrModule?.default + .replace(/^export default "/, '') + .replace(/"$/, ''); + importedStylesMap.set(importedModule.url, styles); } else { // NOTE: We use the `url` property here. `id` would break Windows. importedCssUrls.add(importedModule.url);