Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby should merge .babelrc / babel.config.js to his preset config? #21157

Closed
slorber opened this issue Feb 3, 2020 · 10 comments
Closed

Gatsby should merge .babelrc / babel.config.js to his preset config? #21157

slorber opened this issue Feb 3, 2020 · 10 comments
Labels
status: awaiting author response Additional information has been requested from the author topic: webpack/babel Webpack or babel type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@slorber
Copy link
Contributor

slorber commented Feb 3, 2020

Description

This is a potential bug that I reported on Twitter for which @sidharthachatterjee told me to open an issue:
https://twitter.com/chatsidhartha/status/1224192160464982016

Adding an empty .babelrc or babel.config.js at the root of the project makes everything fail, like if the babel plugin wasn't applied property.

I noticed that on my website, based on Novela theme, which is a bit particular, as it is both a Gatsby/Expo app to simplify cross-platform code sharing (didn't want to create a monorepo as RN bundler does not follow symlinks)

https://github.com/slorber/sebastienlorber.com/tree/gatsby-rnw-v3-expo

Was able to reproduce in the official blog theme too.

Steps to reproduce

gatsby new my-themed-blog https://github.com/gatsbyjs/gatsby-starter-blog-theme
cd my-themed-blog
yarn install
echo "{}" > .babelrc
yarn start

Expected result

It should work fine, gatsby babel preset should still be applied

Actual result

Various errors

In theme blog, it's basic transpilation errors.

In my website I don't get transpilation errors (because the Expo plugin does transpile the Gatsby code) but it seems like there are query/data problems.

image

Environment

 ~/Desktop/projects/my-themed-blog  master ?  yarn gatsby info --clipboard                                                                                                       130 ↵  4139  11:39:32
yarn run v1.21.1
$ /Users/sebastienlorber/Desktop/projects/my-themed-blog/node_modules/.bin/gatsby info --clipboard

  System:
    OS: macOS 10.15.2
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.0 - /var/folders/x0/4p0fybvn02d290vrr9qw5wyh0000gn/T/yarn--1580726374658-0.12296792029289838/node
    Yarn: 1.21.1 - /var/folders/x0/4p0fybvn02d290vrr9qw5wyh0000gn/T/yarn--1580726374658-0.12296792029289838/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 79.0.3945.130
    Firefox: 68.0.1
    Safari: 13.0.4
  npmPackages:
    gatsby: ^2.19.7 => 2.19.7
    gatsby-theme-blog: ^1.2.35 => 1.2.35
  npmGlobalPackages:
    gatsby: 2.13.41

✨  Done in 2.99s.
@gatsbot gatsbot bot added the type: question or discussion Issue discussing or asking a question about Gatsby label Feb 3, 2020
@github-actions
Copy link

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’s 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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 23, 2020
@github-actions
Copy link

github-actions bot commented Mar 4, 2020

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
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 again for being part of the Gatsby community! 💪💜

@github-actions github-actions bot closed this as completed Mar 4, 2020
@wardpeet
Copy link
Contributor

wardpeet commented Mar 4, 2020

@slorber I don't immediately see how we can fix this. We don't know if you want to merge or want to override. You can include our babel-preset-gatsby yourself.

@slorber
Copy link
Contributor Author

slorber commented Mar 4, 2020

sure, I do this, just reported because @sidharthachatterjee asked me on twitter :)

@slorber
Copy link
Contributor Author

slorber commented Apr 4, 2020

@wardpeet @sidharthachatterjee I'd like to reopen this issue.

I've tried to add this on an existing site that worked (based on Novela theme)

module.exports = function(api) {
  return {
    presets: [
      [
        'babel-preset-gatsby',
        {
          targets: {
            browsers: ['>0.25%', 'not dead'],
          },
        },
      ],
    ],
  };
};

Is this normal it breaks my site?

image

Does it mean that plugin babel configs are not applied anymore?

What's the purpose of having a local babel config? Who uses this and how exactly?


I really need a .babelrc at the root of my project, yet when I have one, I'm unable to make my siote work.

Is there an option to tell gatsby to not use the babel config file, even if there is one? Or an ability to configure the configFile path? I would be very interested to have that.

@slorber slorber reopened this Apr 4, 2020
@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Apr 5, 2020
@github-actions
Copy link

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’s 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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Apr 25, 2020
@github-actions
Copy link

github-actions bot commented May 5, 2020

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
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 again for being part of the Gatsby community! 💪💜

@github-actions github-actions bot closed this as completed May 5, 2020
@wardpeet
Copy link
Contributor

wardpeet commented May 7, 2020

@slorber sorry I didn't see this message. have you installed the preset locally as well?

@wardpeet wardpeet reopened this May 7, 2020
@slorber
Copy link
Contributor Author

slorber commented May 7, 2020

Hi,

Honnestly I don't remember, I've found a workaround to achieve my goal since then :)

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label May 7, 2020
@LekoArts
Copy link
Contributor

@slorber Are you fine with closing this then? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting author response Additional information has been requested from the author topic: webpack/babel Webpack or babel type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants