Skip to content

Commit

Permalink
Stop using workerd
Browse files Browse the repository at this point in the history
Vercel Edge Functions don't necessarily implement the same APIs as CF Workers.

If a library supports both, the library has to provide entries for each in `exports`.
  • Loading branch information
eps1lon committed Jun 13, 2024
1 parent d898b77 commit 62882fd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
1 change: 0 additions & 1 deletion packages/next/src/build/webpack-config-rules/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
// exports.<conditionName>
export const edgeConditionNames = [
'edge-light',
'workerd',
// inherits the default conditions
'...',
]
Expand Down
39 changes: 21 additions & 18 deletions test/e2e/import-conditions/import-conditions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { nextTestSetup } from 'e2e-utils'
describe('react version', () => {
const { next } = nextTestSetup({
files: __dirname,
dependencies: {
'library-with-exports': 'link:./library-with-exports',
},
})

it('Pages Router page headers with edge runtime', async () => {
Expand All @@ -19,8 +22,8 @@ describe('react version', () => {
}
expect(middlewareHeaders).toEqual({
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
})
})

Expand All @@ -31,8 +34,8 @@ describe('react version', () => {
expect(JSON.parse(json)).toEqual({
server: {
react: 'default',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
},
client: {
react: 'default',
Expand All @@ -56,8 +59,8 @@ describe('react version', () => {
}
expect(middlewareHeaders).toEqual({
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
})
})

Expand Down Expand Up @@ -93,8 +96,8 @@ describe('react version', () => {
}
expect(middlewareHeaders).toEqual({
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
})
})

Expand All @@ -105,8 +108,8 @@ describe('react version', () => {
expect(JSON.parse(json)).toEqual({
server: {
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
},
client: {
react: 'default',
Expand All @@ -130,8 +133,8 @@ describe('react version', () => {
}
expect(middlewareHeaders).toEqual({
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
})
})

Expand Down Expand Up @@ -169,8 +172,8 @@ describe('react version', () => {
expect({ middlewareHeaders, data }).toEqual({
middlewareHeaders: {
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
},
data: {
react: 'react-server',
Expand All @@ -196,13 +199,13 @@ describe('react version', () => {
expect({ middlewareHeaders, data }).toEqual({
middlewareHeaders: {
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
},
data: {
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
},
})
})
Expand Down

0 comments on commit 62882fd

Please sign in to comment.