Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Babel config is not used (preset-react) #22496

Closed
SimonChaumet opened this issue Feb 24, 2021 · 1 comment
Closed

Babel config is not used (preset-react) #22496

SimonChaumet opened this issue Feb 24, 2021 · 1 comment
Labels
bug Issue was opened via the bug report template.

Comments

@SimonChaumet
Copy link

What version of Next.js are you using?

9.5.2 and 10.0.7

What version of Node.js are you using?

12.19.0

What browser are you using?

Firefox, Chromium

What operating system are you using?

Arch linux

How are you deploying your application?

docker

Describe the Bug

When setting the babel config in .babelrc.js or .babelrc the settings for optimization are not taken into consideration.

In my case I want to keep react display names when env is preproduction.

Expected Behavior

Settings are taken into considerations and display names are not removed.

To Reproduce

  • Create a next project with babel or with Nx
  • add configuration to next/babel preset
  • build.

.babelrc.js :

module.exports = {
  'presets': [
    ['next/babel', {
      'preset-react': {
        development: true,
      },
    }]
  ],
  "plugins": [
    [
      "styled-components",
      {
        "pure": true,
        "ssr": true
      }
    ]
  ]
}

Logs indicates that the right .babelrc.js is used.

@SimonChaumet SimonChaumet added the bug Issue was opened via the bug report template. label Feb 24, 2021
@aacoelho
Copy link

I had a similar problem - babel.config.js was detected by next but wasn't used. I followed this #19334 (comment) reply and it worked. Calling next/babel and the plugin with require.resolve solves my problem.

my babel.config.js :

module.exports = {
  "presets": [
    [require.resolve('next/babel')]
  ],
  "plugins": [
    [require.resolve("@emotion/babel-plugin")]
  ]
}

@vercel vercel locked and limited conversation to collaborators Jan 27, 2022
@balazsorban44 balazsorban44 converted this issue into discussion #33737 Jan 27, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants