Closed batemanio closed 5 months ago
I took a look, and this seems to be due to a few issues.
import.meta.resolve(…)
. This may be a workaround, but the proper solution is for Next.js to support it.It's hard to trace the error message to a detailed cause, but my best guess is that Next.js is not properly able to build module workers. I suspect this is not an issue with cubing.js
, as other folks also seem to have similar issues:
Unfortunately, it seems there isn't much we can do to help you directly. In theory we could consider additional workarounds, but those have a high maintenance cost and cause a lot of trouble — as you can see above, we're already suffering from workarounds that are in place due to other bundlers. Until the JavaScript ecosystem is in a better place, the best we can do is to minimize errors in favor of warnings.
I'd suggest asking in the Next.js project about module worker issues, and let me know if they end up needing a more minimal repro to debug it.
Closing this for now — let us know if you run into additional issues.
Steps to reproduce the issue
I was trying to use cubing.js (specifically cubing/scramble) to generate scrambles in a nextjs project. I used
npx create-next-app@latest --ts
and selected the options:What is your project named? my-nextjs-cubing-app
Would you like to use ESLint? › Yes
Would you like to use Tailwind CSS? › No
Would you like to use src/ directory? › No
Would you like to use App Router? (recommended) › Yes
Would you like to customize the default import alias (@/*)? › No
I then change into the directory using
cd my-nextjs-cubing-app
and then install cubing usingnpm i cubing
and replaced the code in app/page.tsx with:Observed behaviour
I then started it with
npm run dev
.Once it has loaded I open it (http://localhost:3000) on Google Chrome and the scramble appeared fine. I then went into the nextjs console and lots of errors had appeared. The console looked like this:
When I stopped the website and tried doing
npm run build
. It would not work and would output:🖼 Screenshots
No response
Expected behaviour
I expected for there to be no errors while building or running the dev server.
Environment
I am using node v20.10.0 and nextjs version 14.0.4.
Additional info
No response