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:
parent
68f6e2c5a3
commit
21b0c73a2a
2 changed files with 14 additions and 1 deletions
5
.changeset/clever-balloons-learn.md
Normal file
5
.changeset/clever-balloons-learn.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Removes some warnings that are internal to Astro
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue