Skip to content

Commit

Permalink
Merge pull request #189 from nksaraf/run-command
Browse files Browse the repository at this point in the history
fix: catch errors in fs-router fixes #100
  • Loading branch information
nksaraf authored Feb 12, 2024
2 parents 94684d5 + fd2d5e4 commit 8a396cf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-points-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vinxi": patch
---

fix: catch errors in fs-router fixes #100
5 changes: 5 additions & 0 deletions .changeset/wise-wasps-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vinxi": patch
---

fix: separate vite cache dirs for different routers
24 changes: 16 additions & 8 deletions packages/vinxi/lib/fs-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,14 @@ export class BaseFileSystemRouter extends EventTarget {
async addRoute(src) {
src = normalize(src);
if (this.isRoute(src)) {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
try {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
}
} catch (e) {
console.error(e);
}
}
}
Expand All @@ -192,10 +196,14 @@ export class BaseFileSystemRouter extends EventTarget {
async updateRoute(src) {
src = normalize(src);
if (this.isRoute(src)) {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
try {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
}
} catch (e) {
console.error(e);
}
// this.update?.();
}
Expand Down
3 changes: 3 additions & 0 deletions packages/vinxi/lib/router-dev-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const ROUTER_MODE_DEV_PLUGINS = {
ssr: {
noExternal: ["vinxi"],
},
cacheDir: `.vinxi/cache/${router.name}`,
optimizeDeps: {
exclude: ["vinxi"],
},
Expand Down Expand Up @@ -63,6 +64,7 @@ export const ROUTER_MODE_DEV_PLUGINS = {
ssr: {
noExternal: ["vinxi"],
},
cacheDir: `.vinxi/cache/${router.name}`,
define: {
"process.env.TARGET": JSON.stringify(process.env.TARGET ?? "node"),
},
Expand Down Expand Up @@ -99,6 +101,7 @@ export const ROUTER_MODE_DEV_PLUGINS = {
manifest(),
config("appType", {
appType: "custom",
cacheDir: `.vinxi/cache/${router.name}`,
ssr: {
noExternal: ["vinxi"],
},
Expand Down

0 comments on commit 8a396cf

Please sign in to comment.