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

override settings for @babel/preset-env and regenerator. #5264

Closed
wants to merge 1 commit into from

Conversation

heygrady
Copy link
Contributor

@heygrady heygrady commented Oct 3, 2018

#5216

Adds a few new options for babel-preset-react-app. This is useful for cases where you want to customize your build targets, like building for node. This is required for adding server-side rendering to a forked/ejected react-scripts project.

  • presetEnv - defaults to undefined. Used to override the default values for development and prod. Can be any valid options for @babel/present-env
  • presetEnvTest - defaults to undefined. Used to override the default values for test. Can be any valid options for @babel/present-env
  • regenerator - defaults to true, set to false in cases where your targets all support generators natively (like for a node target)

Usage:

Compare to webpack.config.prod.js application bundle

presets: [
  [
    require.resolve('babel-preset-react-app'),
    {
      presetEnv: {
        modules: 'cjs',
        targets: { node: 'current' },
      },
      regenerator: false,
    },
  ],
],

Compare to webpack.config.prod.js dependency bundle

presets: [
  [
    require.resolve('babel-preset-react-app/dependencies'),
    {
      helpers: true,
      presetEnv: {
        modules: 'cjs',
        targets: { node: 'current' },
      },
      regenerator: false,
    },
  ],
],

@stale
Copy link

stale bot commented Nov 5, 2018

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the stale label Nov 5, 2018
@stale
Copy link

stale bot commented Nov 10, 2018

This pull request has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. Thank you for your contribution!

@stale stale bot closed this Nov 10, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants