Gatsby: JSX in gatsby-browser.js causes error in monorepo

Created on 26 Oct 2019  路  3Comments  路  Source: gatsbyjs/gatsby

Description

I use a plugin gatsby-plugin-chakra-ui that has some JSX in gatsby-browser.js. The plugin works fine when it's used inside a normal site.

I'm now building a theme inside a monorepo (yarn workspaces), and I receive an error on gatsby develop:

 ERROR #98123  WEBPACK

Generating SSR bundle failed

Unexpected token (9:2)

File: ../../node_modules/gatsby-plugin-chakra-ui/gatsby-browser.js:9:2

I'm not entirely sure if this is because of JSX, but the location in the file (9:2) is the beginning of the JSX section.

When I move the code inside the plugin inside the theme (from node_modules/gatsby-plugin-chakra-ui/gatsby-browser.js to packages/theme/gatsby-browser.js), it works perfectly fine.

Steps to reproduce

Here is a minimal reproduction. Here is the code for the gatsby-plugin-chakra-ui.

git clone ...
cd ...
yarn
yarn start

Expected result

The site should work.

Actual result

I received an error 馃憜

Environment

  System:
    OS: macOS 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.11.1 - ~/.nvm/versions/node/v12.11.1/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.12.0 - ~/.nvm/versions/node/v12.11.1/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 78.0.3904.70
    Safari: 13.0.2
stale? bug

Most helpful comment

The problem with this issue isn't in Gatsby but in that particular plugin. I've submitted a PR to fix it. Related to #19234

All 3 comments

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

The problem with this issue isn't in Gatsby but in that particular plugin. I've submitted a PR to fix it. Related to #19234

Nicely done, @alexlbr 鉂わ笍

Closing this for now then!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KyleAMathews picture KyleAMathews  路  3Comments

theduke picture theduke  路  3Comments

ghost picture ghost  路  3Comments

brandonmp picture brandonmp  路  3Comments

mikestopcontinues picture mikestopcontinues  路  3Comments