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 17, 2024
1 parent 905a9a7 commit f085c7a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl NextRuntime {
pub fn conditions(&self) -> &'static [&'static str] {
match self {
NextRuntime::NodeJs => &["node"],
NextRuntime::Edge => &["edge-light", "worker"],
NextRuntime::Edge => &["edge-light"],
}
}
}
Expand Down
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
40 changes: 20 additions & 20 deletions test/e2e/import-conditions/import-conditions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ describe('react version', () => {
}
expect(middlewareHeaders).toEqual({
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
})
})

Expand All @@ -34,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 @@ -59,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 @@ -96,8 +96,8 @@ describe('react version', () => {
}
expect(middlewareHeaders).toEqual({
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
})
})

Expand All @@ -111,8 +111,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 @@ -121,8 +121,8 @@ describe('react version', () => {
},
action: {
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
},
})
})
Expand All @@ -141,8 +141,8 @@ describe('react version', () => {
}
expect(middlewareHeaders).toEqual({
react: 'react-server',
serverFavoringBrowser: 'worker',
serverFavoringEdge: 'worker',
serverFavoringBrowser: 'browser',
serverFavoringEdge: 'edge-light',
})
})

Expand Down Expand Up @@ -188,8 +188,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 @@ -215,13 +215,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 f085c7a

Please sign in to comment.