mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-02 19:03:38 +02:00
fix(mdx-loader): suppress image reading warning in Yarn PnP; log warning instead of error (#6779)
This commit is contained in:
parent
3e5da386ce
commit
9d7ed31661
2 changed files with 6 additions and 2 deletions
|
@ -59,7 +59,7 @@ describe('transformImage plugin', () => {
|
|||
});
|
||||
|
||||
test('does not choke on invalid image', async () => {
|
||||
const errorMock = jest.spyOn(console, 'error').mockImplementation();
|
||||
const errorMock = jest.spyOn(console, 'warn').mockImplementation();
|
||||
const result = await processFixture('invalid-img', {staticDirs});
|
||||
expect(result).toMatchSnapshot();
|
||||
expect(errorMock).toBeCalledTimes(1);
|
||||
|
|
|
@ -67,8 +67,12 @@ async function toImageRequireNode(
|
|||
height = ` height="${size.height}"`;
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error`The image at path=${imagePath} can't be read correctly. Please ensure it's a valid image.
|
||||
// Workaround for https://github.com/yarnpkg/berry/pull/3889#issuecomment-1034469784
|
||||
// TODO remove this check once fixed in Yarn PnP
|
||||
if (!process.versions.pnp) {
|
||||
logger.warn`The image at path=${imagePath} can't be read correctly. Please ensure it's a valid image.
|
||||
${(err as Error).message}`;
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(jsxNode).forEach(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue