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

Allow to customize our babel configuration #466

Merged
merged 2 commits into from
Dec 22, 2016

Conversation

arunoda
Copy link
Contributor

@arunoda arunoda commented Dec 21, 2016

This works for both for all of the app pages including the custom document component.

@coveralls
Copy link

coveralls commented Dec 21, 2016

Coverage Status

Coverage decreased (-2.4%) to 58.808% when pulling 32a1d73 on arunoda:custom-babel-config into 9ac79ed on zeit:master.

@rauchg
Copy link
Member

rauchg commented Dec 22, 2016

do expressions 😍

@rauchg rauchg merged commit 1719738 into vercel:master Dec 22, 2016
babel: function (config, { dev }) {
// Add the stage-0 preset.
// Make sure to use 'require.resolve' otherwise we won't be able to find it.
config.presets.push(require.resolve('babel-preset-stage-0'))
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems a bit too hacky to recommend. I wonder if the following works.

import presetStage0 from 'babel-preset-stage0'

...

config.presets.push(presetStage0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't import since it's next.config.js. It didn't work for me for simply giving the preset.

I will try more options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a pretty good option. I like it.
I thought we wanted to expose everything via next.config.js.

@rauchg what do you think?

@nkzawa
Copy link
Contributor

nkzawa commented Dec 22, 2016

Another idea: just use .babelrc if it exists. I can’t remember if we already discussed this option.
Then you can just set presets: ['next/babel'] to extend the default setting.

@arunoda
Copy link
Contributor Author

arunoda commented Dec 22, 2016

That's a pretty good option. I like it.
I thought we wanted to expose everything via next.config.js.

@rauchg what do you think?

@siddharthkp
Copy link
Contributor

@nkzawa, that sounds 😍
Is it safe to assume next/babel would always be applicable and apply it anyways?

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants