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

Support user provided babel configs #279

Merged
merged 6 commits into from
May 11, 2016
Merged

Conversation

benstepp
Copy link
Contributor

@benstepp benstepp commented May 8, 2016

This change allows the user to provide a babelrc or a babel section in
their package.json. It also allows gatsby to be used without having to
specifiy a babelrc if the user doesn't need anything past what babel
provides as a default.

This change allows the user to provide a babelrc or a babel section in
their package.json. It also allows gatsby to be used without having to
specifiy a babelrc if the user doesn't need anything past what babel
provides as a default.

* It resolves all of the paths to become absolute such that the user can
crawl upwards as in gatsbyjs#239.

* It allows the custom usage of other babel plugins so that decorators
work as in gatsbyjs#129.
This is done to support older browsers. Fixes gatsbyjs#264
This will better support versions of npm that do not provide a flat
dependency structure
Updates the readme to describe the new behavior of Babel and Gatsby.
@benstepp
Copy link
Contributor Author

benstepp commented May 8, 2016

Alright, I'm fairly happy with how this turned out. Some highlights:

@KyleAMathews
Copy link
Contributor

This is impressive stuff! Way better than what I kludged together! I really like how you've emulated the normal Babel behavior for users. That's exactly how I envision Gatsby working — magic out-of-box awesomesauce experience but can override/extend it just like you would a normal React/Webpack app.

I'll have some more time tomorrow evening to thoroughly review this + merge and cut new release.


const name = !startsWith(pluginName, 'babel') ? pluginName : `babel-${type}-${pluginName}`
const pluginInvariantMessage = `
You are trying to use a babel plugin which gatsby cannot find. You
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize Gatsby here and below.

@KyleAMathews
Copy link
Contributor

looking good!

When refering to the main package:
* Gatsby is always capitalized
* Babel is always capitalized
* webpack is always lowercase

When refering to an npm package by name, the name becomes lowercase:
* babel-loader
* json5
* babel-type-*

When refering to a specific file it is lowercase:
* package.json
* .babelrc
Now that the babel config is resolved externally so that it can be
stubbed out and tested, webpack.config.js does not know how to change
the loader based on the stage.
@KyleAMathews KyleAMathews merged commit f41081f into gatsbyjs:master May 11, 2016
KyleAMathews added a commit that referenced this pull request May 11, 2016
Support user provided babel configs

Conflicts:
	lib/utils/webpack.config.js
	package.json
@KyleAMathews
Copy link
Contributor

Merged! Will release 0.11 in the morning.

This was referenced Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants