Fix: add "CSS" to noExternal hint (#3426)

* chore: add "CSS" to noExternal hint

* chore: changeset
This commit is contained in:
Ben Holmes 2022-05-24 12:43:07 -04:00 committed by GitHub
parent 4e3b405e9e
commit 946630a112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Logs: Add "ssr.noExternal" hint for CSS loaded from npm packages

View file

@ -47,7 +47,7 @@ const incompatiblePackages = {
const incompatPackageExp = new RegExp(`(${Object.keys(incompatiblePackages).join('|')})`); const incompatPackageExp = new RegExp(`(${Object.keys(incompatiblePackages).join('|')})`);
function generateHint(err: ErrorWithMetadata): string | undefined { function generateHint(err: ErrorWithMetadata): string | undefined {
if (/Unknown file extension \"\.(jsx|vue|svelte|astro)\" for /.test(err.message)) { if (/Unknown file extension \"\.(jsx|vue|svelte|astro|css)\" for /.test(err.message)) {
return 'You likely need to add this package to `vite.ssr.noExternal` in your astro config file.'; return 'You likely need to add this package to `vite.ssr.noExternal` in your astro config file.';
} else { } else {
const res = incompatPackageExp.exec(err.stack); const res = incompatPackageExp.exec(err.stack);