diff --git a/packages/gatsby-plugin-image/src/components/__tests__/gatsby-image.browser.tsx b/packages/gatsby-plugin-image/src/components/__tests__/gatsby-image.browser.tsx index 552654e0fc14a..09efa696079a4 100644 --- a/packages/gatsby-plugin-image/src/components/__tests__/gatsby-image.browser.tsx +++ b/packages/gatsby-plugin-image/src/components/__tests__/gatsby-image.browser.tsx @@ -74,10 +74,12 @@ describe(`GatsbyImage browser`, () => { jest.clearAllMocks() global.SERVER = undefined global.GATSBY___IMAGE = undefined + process.env.NODE_ENV = `test` }) it(`shows a suggestion to switch to the new gatsby-image API when available`, async () => { global.GATSBY___IMAGE = undefined + process.env.NODE_ENV = `development` const { container } = render( @@ -85,7 +87,7 @@ describe(`GatsbyImage browser`, () => { await waitFor(() => container.querySelector(`[data-placeholder-image=""]`)) - expect(console.error).toBeCalledWith( + expect(console.warn).toBeCalledWith( `[gatsby-plugin-image] You're missing out on some cool performance features. Please add "gatsby-plugin-image" to your gatsby-config.js` ) }) diff --git a/packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx b/packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx index ac9266ee48adc..3a473d5a88335 100644 --- a/packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx +++ b/packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx @@ -276,8 +276,8 @@ export const GatsbyImage: FunctionComponent = return null } - if (!gatsbyImageIsInstalled()) { - console.error( + if (!gatsbyImageIsInstalled() && process.env.NODE_ENV === `development`) { + console.warn( `[gatsby-plugin-image] You're missing out on some cool performance features. Please add "gatsby-plugin-image" to your gatsby-config.js` ) }