aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-01 21:37:09 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-01 21:37:09 -0800
commit8cf1707cd3192814b5eb3ff99b175e211d6b1779 (patch)
treef993fa143acc385f47cb13b452e17369234106a4 /src
parent9f4d7690ace86048abad38cfaf51eb99e944449b (diff)
downloadbun-8cf1707cd3192814b5eb3ff99b175e211d6b1779.tar.gz
bun-8cf1707cd3192814b5eb3ff99b175e211d6b1779.tar.zst
bun-8cf1707cd3192814b5eb3ff99b175e211d6b1779.zip
[bun bun] Fix crash in canary
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/api/filesystem_router.zig4
-rw-r--r--src/bundler.zig9
2 files changed, 10 insertions, 3 deletions
diff --git a/src/bun.js/api/filesystem_router.zig b/src/bun.js/api/filesystem_router.zig
index d1cec699e..41209f867 100644
--- a/src/bun.js/api/filesystem_router.zig
+++ b/src/bun.js/api/filesystem_router.zig
@@ -258,7 +258,7 @@ pub const FileSystemRouter = struct {
.extensions = if (extensions.items.len > 0) extensions.items else default_extensions,
.asset_prefix_path = asset_prefix_slice.slice(),
}) catch unreachable;
- router.loadRoutes(&log, root_dir_info, Resolver, &vm.bundler.resolver) catch {
+ router.loadRoutes(&log, root_dir_info, Resolver, &vm.bundler.resolver, router.config.dir) catch {
globalThis.throwValue(log.toJS(globalThis, globalThis.allocator(), "loading routes"));
origin_str.deinit();
arena.deinit();
@@ -324,7 +324,7 @@ pub const FileSystemRouter = struct {
.extensions = allocator.dupe(string, this.router.config.extensions) catch unreachable,
.asset_prefix_path = this.router.config.asset_prefix_path,
}) catch unreachable;
- router.loadRoutes(&log, root_dir_info, Resolver, &vm.bundler.resolver) catch {
+ router.loadRoutes(&log, root_dir_info, Resolver, &vm.bundler.resolver, router.config.dir) catch {
globalThis.throwValue(log.toJS(globalThis, globalThis.allocator(), "loading routes"));
arena.deinit();
diff --git a/src/bundler.zig b/src/bundler.zig
index 84783cd70..01c23dac0 100644
--- a/src/bundler.zig
+++ b/src/bundler.zig
@@ -691,6 +691,7 @@ pub const Bundler = struct {
dir_info,
Resolver,
&this.resolver,
+ this.fs.top_level_dir,
);
this.router.?.routes.client_framework_enabled = this.options.isFrontendFrameworkEnabled();
return;
@@ -703,7 +704,13 @@ pub const Bundler = struct {
this.options.routes.dir = dir_info.abs_path;
this.router = try Router.init(this.fs, this.allocator, this.options.routes);
- try this.router.?.loadRoutes(this.log, dir_info, Resolver, &this.resolver);
+ try this.router.?.loadRoutes(
+ this.log,
+ dir_info,
+ Resolver,
+ &this.resolver,
+ this.fs.top_level_dir,
+ );
this.router.?.routes.client_framework_enabled = this.options.isFrontendFrameworkEnabled();
return;
}