Skip to content

Commit 5f540e4

Browse files
committed
🔧 fix: async module doesn't load
1 parent fbb7dca commit 5f540e4

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.2.3 - 27 Dec 2024
2+
Bug fix:
3+
- async module doesn't load (eg. @elysiajs/swagger)
4+
15
# 1.2.2 - 27 Dec 2024
26
Bug fix:
37
- Set minimum Elysia version to 1.2.7

bun.lockb

3.3 KB
Binary file not shown.

example/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { Elysia, file } from 'elysia'
22
import { cors } from '@elysiajs/cors'
3+
import { swagger } from '@elysiajs/swagger'
34
import { node } from '../src'
45

56
const plugin = async () => new Elysia().get('/async', () => 'ok')
67

78
const app = new Elysia({
8-
// adapter: node()
9+
adapter: node()
910
})
1011
.use(cors())
12+
.use(swagger())
1113
.get('/image', () => file('test/kyuukurarin.mp4'))
1214
.post('/', ({ body }) => body, {
1315
type: 'json'

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elysiajs/node",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "Plugin for Elysia for retreiving Bearer token",
55
"license": "MIT",
66
"scripts": {
@@ -27,6 +27,7 @@
2727
},
2828
"devDependencies": {
2929
"@elysiajs/cors": "^1.2.0",
30+
"@elysiajs/swagger": "^1.2.0",
3031
"@types/formidable": "^3.4.5",
3132
"@types/node": "^22.10.2",
3233
"@types/ws": "^8.5.13",

src/index.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ import { mapResponse, mapEarlyResponse, mapCompactResponse } from './handler'
1919

2020
import { attachWebSocket } from './ws'
2121
import { WebStandardAdapter } from 'elysia/adapter/web-standard'
22-
import { readFileToWebStandardFile, unwrapArrayIfSingle, withResolvers } from './utils'
22+
import {
23+
readFileToWebStandardFile,
24+
unwrapArrayIfSingle,
25+
withResolvers
26+
} from './utils'
2327

2428
export const ElysiaNodeContext = Symbol('ElysiaNodeContext')
2529

@@ -438,11 +442,16 @@ export const node = () => {
438442
if (callback) callback(serverInfo)
439443

440444
app.modules.then(() => {
441-
if (typeof options === 'object')
442-
try {
443-
// @ts-ignore
444-
serverInfo.reload(options)
445-
} catch {}
445+
try {
446+
serverInfo.reload(
447+
// @ts-expect-error
448+
typeof options === 'object'
449+
? options
450+
: {
451+
port: options
452+
}
453+
)
454+
} catch {}
446455
})
447456
}
448457
)

0 commit comments

Comments
 (0)