Search code examples
reactjsgatsbynetlify

Problems using Netlify to host Gatsby built site


Im getting this error

./node_modules/gatsby/cache-dir/gatsby-browser-entry.js Module parse failed: Unexpected token (26:4) You may need an appropriate loader to handle this file type.

    |
    |  return (
    |    <React.Fragment>
    |      {finalData && render(finalData)}
    |      {!finalData && <div>Loading (StaticQuery)</div>}

gatsby-browswer-entry.js only has this inside of it: import './src/styles/tailwind.css'

None of my .js files are failing to import the 'Link' component


Solution

  • Sometimes, depending on Gatsby's version and its dependencies, you need to import the component from gatsby-link rather than gatsby, so:

    // import { Link } from "gatsby" // error 
    import Link from "gatsby-link" // not error