Skip to content

[v2] Babel 7 ideas #3870

Closed
Closed
@KyleAMathews

Description

@KyleAMathews

Chatted with @loganfsmyth this afternoon about how best to upgrade Gatsby to v7 of Babel.

  1. Disable reading any .babelrc files — since we load babelrc directly we shouldn't allow babel to go looking for additional babelrc files. I'm not sure how to do this should would appreciate some pointers.
  2. Remove stage-0 preset
  3. Potentially add way to opt-out of reading a user's .babelrc file — potentially they could be using Babel v6 for e.g. a test framework. While they haven't upgraded that to v7 of Babel, their .babelrc file would cause conflicts. We were unsure if this would be a real issue or not so we'll probably wait and see if there's problems before adding support for this.
  4. Logan says Babel is moving towards having more regular releases. One way to loosen the coupling between Gatsby and Babel is to move Gatsby's Babel setup to a package which Gatsby depends on e.g. gatsby-babel. When there's a new major version of Babel, we release a new version of gatsby-babel that people can optional add as a dependency along with the new version of babel-core. Then when we require gatsby-babel we first check if the site has a direct dependency on gatsby-babel and preferentially use that and fall back on the default version. Once the new version of Babel is stable, on the next major release of Gatsby we'd update our gatsby-babel version.
  5. Copy CRA's implementation for compiling node_modules with babel-preset-env which will fix problems like "gatsby build" breaks when dependencies use es6 code (which Uglify doesn't support) #3780

/cc @jquense

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions