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

Create babel preset instead of copying entire config into project #2532

Closed
skipkayhil opened this issue Apr 13, 2020 · 1 comment · Fixed by #2633
Closed

Create babel preset instead of copying entire config into project #2532

skipkayhil opened this issue Apr 13, 2020 · 1 comment · Fixed by #2633

Comments

@skipkayhil
Copy link
Member

skipkayhil commented Apr 13, 2020

Currently, webpacker copies the pre made babel.config.js into your project when the install script is run, however this leads to some issues:

  • users who would never touch their babel.config.js now have a complicated file they have to maintain
  • updates to babel.config.js in webpacker repo have to be manually grabbed by users
  • the babel.config.js in the project uses require on webpacker dependencies, which is not ideal and is a blocker to adopting Yarn 2 Yarn 2.0 (Yarn Plug’n’Play) #2112

To solve these issues, I think webpacker (or an accompanying package) should provide a babel preset that projects can then use:

// babel.config.js
module.exports = {
  presets: ["@rails/babel-preset-webpacker"]
}

or

// babel.config.js
module.exports = {
  presets: ["./node_modules/@rails/webpacker/.../babel.config.js"]
}

This would greatly simplify the configuration for basic cases, while still allowing the flexibility to add additional configuration or ignoring the preset completely for advanced cases.

I am willing to help out with this and can create a PR if needed.

@skipkayhil
Copy link
Member Author

skipkayhil commented Apr 23, 2020

@gauravtiwari You've mentioned this before, how can I help to get this done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants