Remove warnings coming from snowpack (#329)

* Remove warnings coming from snowpack

This removes a few warnings coming from snowpack that we can't really do anything about.

* Adds changeset
This commit is contained in:
Matthew Phillips 2021-06-08 09:45:15 -04:00 committed by GitHub
parent 68f6e2c5a3
commit 21b0c73a2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Removes some warnings that are internal to Astro

View file

@ -3,6 +3,14 @@ import { defaultLogLevel } from './logger.js';
const onceMessages = ['Ready!', 'watching for file changes'].map((str) => new RegExp(`\\[snowpack\\](.*?)${str}`));
const neverWarn = new RegExp('('
+ /(run "snowpack init" to create a project config file.)|/.source
+ /(astro\/dist\/internal\/__astro_component.js: Unscannable package import found.)|/.source
+ /(Cannot call a namespace \('loadLanguages'\))|/.source
+ /('default' is imported from external module 'node-fetch' but never used)/.source
+ ')'
);
export function configureSnowpackLogger(logger: typeof snowpackLogger) {
const messageCache = new Set<string>();
@ -12,7 +20,7 @@ export function configureSnowpackLogger(logger: typeof snowpackLogger) {
logger.on('warn', (message) => {
// Silence this output message, since it doesn't make sense for Astro.
if (message.includes(`run "snowpack init" to create a project config file.`)) {
if (neverWarn.test(message)) {
return;
}
console.error(message);