Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
DominusKelvin committed Apr 16, 2024
2 parents 9953ada + 298927d commit 55eb040
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 165 deletions.
20 changes: 19 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ module.exports = function defineShipwrightHook(sails) {
chunkSplit: {
strategy: 'all-in-one'
}
},
server: {
port: sails.config.port,
strictPort: true,
printUrls: false
}
})
const config = mergeRsbuildConfig(
Expand All @@ -78,7 +83,20 @@ module.exports = function defineShipwrightHook(sails) {
if (process.env.NODE_ENV == 'production') {
rsbuild.build()
} else {
rsbuild.build({ mode: 'development', watch: true })
const rsbuildDevServer = await rsbuild.createDevServer()
sails.after('hook:http:loaded', async () => {
sails.hooks.http.app.use(rsbuildDevServer.middlewares)
sails.hooks.http.server.on(
'upgrade',
rsbuildDevServer.onHTTPUpgrade
)
})
sails.on('lifted', async () => {
await rsbuildDevServer.afterListen()
})
sails.on('lower', async () => {
await rsbuildDevServer.close()
})
}
} catch (error) {
sails.error(error)
Expand Down
Loading

0 comments on commit 55eb040

Please sign in to comment.