Skip to content

Custom .babelrc file not being loaded after upgrading to Next.js 11 #26539

@AndreSilva1993

Description

@AndreSilva1993

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

12.16.1

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Other platform

Describe the Bug

Before upgrading to Next.js 11, my custom .babelrc file (which sits in the project's root directory) would be picked up by and used. When I booted up the project, I would always receive this message:

screenshot

However, after upgrading to 11, I no longer get this message when booting up the application and Emotion started complaining about some features that require the usage of their @emotion/babel-plugin which leads me to believe that the Babel custom configuration is not being picked up. I do have a custom server and my .babelrc looks like this:

{
  "plugins": ["@emotion/babel-plugin"],
  "presets": [
    [
      "next/babel",
      {
        "preset-react": {
          "runtime": "automatic",
          "importSource": "@emotion/react"
        }
      }
    ]
  ],
  "env": {
    "test": {
      "plugins": ["babel-plugin-dynamic-import-node"]
    }
  }
}

Expected Behavior

Next.js application would pick up the .babelrc file like it's stated in its documentation and like it happened in v10.

To Reproduce

https://stackblitz.com/edit/nextjs-h1ihd3

In here I added a simple custom server that I took directly from your documentation and you can see that the message about the custom .babelrc being picked up, does not appear. You just need to run node server.js in the terminal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    WebpackRelated to Webpack with Next.js.bugIssue was opened via the bug report template.lockedstaleThe issue has not seen recent activity.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions