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

Getting a type error during build time of a Next.js project #98

Closed
fahim-arif opened this issue Jan 18, 2023 · 4 comments · Fixed by #99
Closed

Getting a type error during build time of a Next.js project #98

fahim-arif opened this issue Jan 18, 2023 · 4 comments · Fixed by #99

Comments

@fahim-arif
Copy link

I am trying to use Mux upload functionality and followed similar approach with Next.js Mux exmaple (https://github.com/vercel/next.js/tree/canary/examples/with-mux-video). Everything works fine on my local machine but when I try to build the project, I get a build error from node_modules/@mux/upchunk/dist/upchunk.d.ts:1:15 file.

Fyi, I am using node version: v18.12.1 and Next.js version 12

Screenshot 2023-01-14 at 9 07 43 PM

@dylanjha
Copy link
Contributor

Thanks @fahim-arif for the report. We'll see what's going on here.

Just for a quick check, can you make sure you're on the latest version of UpChunk and also check the typescript version?

@cjpillsbury
Copy link
Contributor

Hey @fahim-arif it looks like a typescript compatibility issue. The error is reffering to syntax we're using that was introduced in TS v4.5 (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names)

A couple of things you could try:

  1. If this is a new project, try using the latest version of next.js (next@13.1.2) From your screenshot, it looks like you're on the previous major version, which I believe has a somewhat out of date version of typescript. The latest should include typescript@4.9.4 on a fresh use of create next app (e.g. yarn create next-app).
  2. Since this is effectively a typescript version issue and not a next.js issue, you could also simply try upgrading the version of typescript you're using to the latest version (or anything >= 4.5 should work).

With all of that said, I still am considering this an issue and planning a quick fix/release, since we can easily re-write the error-producing code in a way that would be compatible with versions as old as 3.8 (see: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export). Appreciate the feedback!

@cjpillsbury
Copy link
Contributor

@fahim-arif just a quick update: I cut a patch release of @mux/upchunk@3.0.1 this morning, which should also fix your issue, but let us know if you try it out and you're still seeing the problem.

@fahim-arif
Copy link
Author

I upgraded to the latest version of @mux/upchunk@3.0.1 and the issue I had before is now fixed! Thanks you @cjpillsbury @dylanjha and everyone who helped fixing this issue in a such a short amount time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants