Skip to content

Commit

Permalink
Merge pull request #261 from yume-chan/fix/fs-allow
Browse files Browse the repository at this point in the history
fix: allow serving resource files from monorepo in dev server
  • Loading branch information
nksaraf authored Mar 21, 2024
2 parents 00d68f0 + e6f9faf commit ac6fc57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/many-jobs-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vinxi": patch
---

fix: allow serving resource files from monorepo in dev server
6 changes: 5 additions & 1 deletion packages/vinxi/lib/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export async function createViteDevServer(config) {
* @returns {Promise<import("vite").ViteDevServer>}
*/
export async function createViteHandler(router, app, serveConfig) {
const vite = await import("vite");
const { getRandomPort } = await import("get-port-please");
const port = await getRandomPort();
const plugins = [
Expand All @@ -72,7 +73,10 @@ export async function createViteHandler(router, app, serveConfig) {
app,
server: {
fs: {
allow: [normalize(fileURLToPath(new URL("../", import.meta.url))), "."],
allow: [
normalize(fileURLToPath(new URL("../", import.meta.url))),
vite.searchForWorkspaceRoot(process.cwd()),
],
},
middlewareMode: true,
hmr: {
Expand Down

0 comments on commit ac6fc57

Please sign in to comment.