Reputation: 33
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
Upvotes: 3
Views: 204
Reputation: 11
I had a similar issue, and was only exposed when running tests in cypress. I had used gatsby's navigate function in a non-jsx javascript helper file. I think the error is indicative of a bundling / webpack issue and you have to look at the stack trace to see the actual culprit file.
Upvotes: 0
Reputation: 29320
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
Upvotes: 2