The resulting static html code from gatsby-image
is something like this:
<div class=" gatsby-image-wrapper" style="position: relative; overflow: hidden;">
<!-- Placeholder here (removed for abreviation)... -->
<picture>
<!-- Image tag and `sources` here... -->
</picture>
<!-- ⚠ This is what I want to remove ⚠ -->
<noscript>
<picture>
<!-- Image tag and `sources` here... -->
</picture>
</noscript>
<!-- ⚠ This is what I want to remove ⚠ -->
</div>
I couldn't find an option to <noscript>
in the docs.
This is the image component:
import * as React from "react"
import { StaticQuery, graphql } from "gatsby"
import Img from "gatsby-image"
const MyPhoto = () => (
<StaticQuery
query={graphql`
query {
placeholderImage: file(relativePath: { eq: "image.png" }) {
childImageSharp {
fluid(maxWidth: 160) {
...GatsbyImageSharpFluid_withWebp
}
}
}
}
`}
render={data => <Img loading="eager" fluid={data.placeholderImage.childImageSharp.fluid} />}
/>
)
export default MyPhoto
Pretty much the default that comes with this starter template: gatsby-starter-typescript-jest.
This is the gatsby-config.js, I've removed some unecessary comments and properties:
module.exports = {
plugins: [
`gatsby-plugin-preact`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {...myManifestOptions},
},
`gatsby-plugin-typescript`,
],
}
The reason is that I just don't want to add support for disabled javascript.