Cannot use local Next.js build as Next.js Dev Server (v14.2.6) #69316
Labels
bug
Issue was opened via the bug report template.
Developer Experience
Issues related to Next.js logs, Error overlay, etc.
Link to the code that reproduces this issue
https://github.com/Ethan-Arrowood/next-dev-server-issue
To Reproduce
Reproduction
Clone
vercel/next.js
Check out tag
v14.2.6
withgit checkout tags/v14.2.6
(Install deps and build Next.js locally) Run
pnpm i
, thencd packages/next-swc
,pnpm build-native
, and thencd ../..
andpnpm build
Link it locally,
npm link
Clone this repo
Within
next-app
, runnpm i
- no need to link Next.js locally hereWithin
next-server
, runnpm i
andnpm link next
Run the server with
node server.js
(use Node v20)Visit
localhost:3000
, you'll seeInvariant: Expect to replace at least one import
in the console:Now if you just use the npm installed
next@14.2.6
dependency, everything works fine. But not being able to do this with a locally built version of Next.js is preventing me from debugging other things.This error is coming from here: https://github.com/vercel/next.js/blob/v14.2.6/packages/next/src/build/load-entrypoint.ts#L83
I used a debugger on the local Next.js build, and discovered that when
load-entrypoint.ts
is executing, the template file it receives contains'
characters instead of the"
the regex is expecting. This makes me think its something with how I'm building Next.js locally? See the following screenshot for more info:Current vs. Expected behavior
I expect this to work locally just like when I use the Next.js dependency from
npm install
.Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030 Available memory (MB): 18432 Available CPU cores: 12 Binaries: Node: 20.16.0 npm: 10.8.1 Yarn: 1.22.22 pnpm: 9.7.0 Relevant Packages: next: 14.2.6 // Latest available version is detected (14.2.6). eslint-config-next: 14.2.6 react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Developer Experience
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
👋 Hi friends, hope all is well on the team. I had a feeling I'd be collaborating with y'all again 💙
The text was updated successfully, but these errors were encountered: