Unverified Commit fd7bd124 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix tracing edge-runtime dependencies (#39009)

* Fix tracing edge-runtime dependencies

* update compiled

* remove old console log
parent 8ae6f286
......@@ -1148,7 +1148,6 @@ export async function copyTracedFiles(
const symlink = await fs.readlink(tracedFilePath).catch(() => null)
if (symlink) {
console.log('symlink', path.relative(tracingRoot, symlink))
await fs.symlink(symlink, fileOutputPath)
} else {
await fs.copyFile(tracedFilePath, fileOutputPath)
......
......@@ -296,6 +296,15 @@ export async function ncc_edge_runtime(task, opts) {
.source(opts.src || relative(__dirname, require.resolve('edge-runtime')))
.ncc({ packageName: 'edge-runtime', externals })
.target('compiled/edge-runtime')
const outputFile = join(__dirname, 'compiled/edge-runtime/index.js')
await fs.writeFile(
outputFile,
(
await fs.readFile(outputFile, 'utf8')
).replace(/eval\("require"\)/g, 'require')
)
}
// eslint-disable-next-line camelcase
......
......@@ -1243,4 +1243,38 @@ describe('should set-up next', () => {
expect(envVariables.envProd).not.toBeUndefined()
expect(envVariables.envLocal).toBeUndefined()
})
it('should run middleware correctly without minimalMode', async () => {
await killApp(server)
const testServer = join(next.testDir, 'standalone/server.js')
await fs.writeFile(
testServer,
(
await fs.readFile(testServer, 'utf8')
).replace('minimalMode: true', 'minimalMode: false')
)
appPort = await findPort()
server = await initNextServerScript(
testServer,
/Listening on/,
{
...process.env,
PORT: appPort,
},
undefined,
{
cwd: next.testDir,
onStderr(msg) {
if (msg.includes('top-level')) {
errors.push(msg)
}
stderr += msg
},
}
)
const res = await fetchViaHTTP(appPort, '/')
expect(res.status).toBe(200)
expect(await res.text()).toContain('index page')
})
})
import { NextResponse } from 'next/server'
export async function middleware(req) {
console.log('middleware', req.url)
return NextResponse.next()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment