-
Notifications
You must be signed in to change notification settings - Fork 4
prepareCrosswalk updates #1619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
prepareCrosswalk updates #1619
Conversation
lib/index.js
Outdated
@@ -361,8 +361,10 @@ export class Baker extends EventEmitter { | |||
return; | |||
} | |||
|
|||
preppedData.assets[normalizedAssetType][normalizedAssetName][ext] = | |||
this.getStaticPath(path); | |||
if (path && path.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just check if (path)
, this will catch undefined
, null
, and empty strings. If there is no path we should show an error or warning. So code should look like:
if (!path) {
console.error(`Could not find static path for asset :${normalizedAssetName} and path: ${path}`);
return;
}
preppedData.assets[normalizedAssetType][normalizedAssetName][ext] = this.getStaticPath(path);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We implemented this suggestion and tweaked the error message. We made it into a warning instead because the error message being in red felt like it would be an error that would stop the build, but it's not.
if (!path) {
console.warn(
`Could not find static path for asset: ${normalizedAssetName} with the extension: ${ext}. Skipping.`
);
return;
}
Is there a way to maybe run npm start with both a quiet version and a --verbose version that prints out the warnings? If your crosswalk has a lot of different file types, the warnings can be a little overwhelming, and it may be useful to have an option to show only errors instead of warnings.
No description provided.