fix: loader support for server-only (#6383)
## Description Allows `server-only` to work within the Payload loader. Fixes https://github.com/payloadcms/payload-3.0-demo/issues/218
This commit is contained in:
@@ -11,6 +11,11 @@ describe('Loader', () => {
|
||||
expect(code).toStrictEqual(0)
|
||||
})
|
||||
|
||||
it('should import server-only without breaking', async () => {
|
||||
const code = await startChildProcess('./server-only-test.ts')
|
||||
expect(code).toStrictEqual(0)
|
||||
})
|
||||
|
||||
it('should import configs that rely on custom components', async () => {
|
||||
const code = await startChildProcess('../admin/config.ts')
|
||||
expect(code).toStrictEqual(0)
|
||||
|
||||
3
test/loader/server-only-test.ts
Normal file
3
test/loader/server-only-test.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import 'server-only'
|
||||
|
||||
console.log('woo')
|
||||
@@ -48,6 +48,7 @@
|
||||
"execa": "5.1.1",
|
||||
"http-status": "1.6.2",
|
||||
"payload": "workspace:*",
|
||||
"server-only": "^0.0.1",
|
||||
"tempy": "^1.0.1",
|
||||
"ts-essentials": "7.0.3",
|
||||
"typescript": "5.4.5",
|
||||
|
||||
Reference in New Issue
Block a user