-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Feature Request: babel-preset-gatsby additional settings #12409
Comments
I'm not sure this needs to live in babel-preset-env. One really important note here is that we generally want to keep development and build as unified as possible. If we include something in development that is not included in production, I could see that leading to bugs just as frequently as not including polyfills at all. That being said--development should work in IE 11, so if it doesn't--let's fix that!
This probably makes sense as a quick remediation and exposing an option (defaulted to current behavior of usage). Something like (in your app) with module.exports = {
presets: [
['babel-preset-gatsby', {
useBuiltIns: 'entry'
}]
]
} Would need to validate that these changes don't cause issues in any current flow while also providing a feasible alternative for users with requirements of supporting browsers like IE 11. |
Thanks. As I mention in my reply to #12399 I think Gatsby already treats development differently from prodution. From the docs for babel-preset-gatsby:
My understanding of this is that in production, the browser range is:
But in development it is:
So unless I'm misunderstanding the docs, this problem can be fixed by using the same browser range for both cases (at least in userland). |
Well - let's not make changes quite yet! Are there issues with development in IE 11? I think I asked that in #12399, but not sure that was ever answered! In other words, can you develop your app in develop mode in IE 11? |
Only if I:
I've just done some tests with Gatsby's default starter (available here). Contrary to the docs it seems that Gatsby does Polyfill for IE11 in development and I could use I then installed yup and used it within the starter. This immediately raises an error:
Which originates from within This means that:
To illustrate 2, this is the code I added inside import React from "react"
import * as Yup from "yup"
export const SCHEMA = Yup.object().shape({
example: Yup.string(),
})
const Header = ({ siteTitle }) => {
const a = ["a", "b", "c"]
console.log("Found", a.find(e => e === "b", a)) // This logs successfully if yup isn't imported or referenced
console.log("Schema", SCHEMA)
... |
@DSchau I've added a writeup as to how I got things working in #12399. In terms of improving things I think it would be great if
I'd be happy to put a PR together adding these two config params. |
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! Thanks for being a part of the Gatsby community! 💪💜 |
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 Thanks again for being part of the Gatsby community! |
So I think this is the rub: Exposing |
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 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! |
Still an issue so reopening. |
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! 💪💜 |
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 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! |
Summary
It would be very useful to be able to override:
gatsby develop
.usage
vsentry
). When using third part modules that require polyfilling, Gatsby will not apply the polyfills they need. Switching toentry
would allow third party modules to be covered.Basic example
It currently exposes only a
targets
setting. It could add additionaldevelopmentTargets
andbabelEnvStrategy
settings.Motivation
Currently to change these settings you need to copy the whole of Gatsby's babel config and edit. IMHO it would make more sense to expose these settings as an API for the plugin.
The text was updated successfully, but these errors were encountered: