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

Next.js 11 fails on custom .babelrc with JSON5 syntax #26163

Closed
jwilsson opened this issue Jun 16, 2021 · 4 comments · Fixed by #26194
Closed

Next.js 11 fails on custom .babelrc with JSON5 syntax #26163

jwilsson opened this issue Jun 16, 2021 · 4 comments · Fixed by #26194
Labels
bug Issue was opened via the bug report template.

Comments

@jwilsson
Copy link
Contributor

What version of Next.js are you using?

11.0.0 (same issue with 11.0.1-canary.0)

What version of Node.js are you using?

16.3.0

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

next dev

Describe the Bug

This is a follow-up to #26131 given that was closed and I've managed to really track it down further. I think #26156 is caused by the same issue as well.

When using a custom .babelrc containing a trailing comma (or other JSON5 syntax) the config parsing will fail. Babel's docs mentions they using JSON5 to parse .babelrc files which isn't the case in the new Next.js 11 babel-loader. I think it would make sense to follow the same behaviour as Babel.

Expected Behavior

No errors, Next should be able to use my custom .babelrc just fine.

To Reproduce

Create a .babelrc file in the root of your Next.js project.

Enter the following code:

{
    "presets": ["next/babel"],
}

This will also trigger the same issue:

{
    "presets": ["next/babel"] // Note, no trailing comma but a comment
}

I'd be happy to provide a PR fixing this issue.

@HassaanShah016
Copy link

@timneutkens What's the solution ?

@kodiakhq kodiakhq bot closed this as completed in #26194 Jun 16, 2021
kodiakhq bot pushed a commit that referenced this issue Jun 16, 2021
## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes

Fixes: #26163
@ijjk
Copy link
Member

ijjk commented Jun 16, 2021

This should be fixed in v11.0.1-canary.2 of Next.js, please update and give it a try!

flybayer pushed a commit to blitz-js/next.js that referenced this issue Jun 24, 2021
## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes

Fixes: vercel#26163
@tunesmith
Copy link
Contributor

Came here from #25434, but it looks like this bug also exists on 10.2.4.canary3.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants