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

Vendored useSubscription is not ES5-compatible #35912

Closed
1 task done
merrywhether opened this issue Apr 5, 2022 · 1 comment · Fixed by #39358
Closed
1 task done

Vendored useSubscription is not ES5-compatible #35912

merrywhether opened this issue Apr 5, 2022 · 1 comment · Fixed by #39358
Labels
bug Issue was opened via the bug report template.

Comments

@merrywhether
Copy link

merrywhether commented Apr 5, 2022

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000
Binaries:
  Node: 16.14.0
  npm: 8.3.1
  Yarn: 1.22.17
  pnpm: N/A
Relevant packages:
  next: 12.1.4
  react: 17.0.2
  react-dom: 17.0.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

A version of useSubscription interned/vendored into Next (#35746) because of its new peer-dep declaration. This version contains an arrow function which is not ES5-compatible.

Expected Behavior

Next currently states that it is ES5 compatible, so it should not contain this arrow function. #33227

I've also created #35913 to try to prevent these situations in the future.

To Reproduce

  1. Create a next app (e.g. npx create-next-app@latest)
  2. Add a dynamic import (the code-path that contains internal useSubscription usage). For example, change pages/index.js to dynamically import the Image component:
import Head from 'next/head';
import styles from '../styles/Home.module.css';
import dynamic from 'next/dynamic';
const Image = dynamic(() => import('next/image'));
  1. Run next build
  2. Run npx es-check es5 '.next/static/**/*.js'

Get error:

error: ES-Check: there were 1 ES version matching errors.

info: 
          ES-Check Error:
          ----
          · erroring file: .next/static/chunks/pages/index-35bd0f2403564f83.js
          · error: SyntaxError: Unexpected token (1:8374)
          · see the printed err.stack below for context
          ----

          SyntaxError: Unexpected token (1:8374)
@merrywhether merrywhether added the bug Issue was opened via the bug report template. label Apr 5, 2022
@kodiakhq kodiakhq bot closed this as completed in #39358 Aug 5, 2022
kodiakhq bot pushed a commit that referenced this issue Aug 5, 2022
So we don't regress on issues like #39090, #35913, #34629, #33314, etc.

Closes #35912

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## 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.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 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.

1 participant