diff options
author | 2022-01-04 20:15:05 -0800 | |
---|---|---|
committer | 2022-01-04 20:15:05 -0800 | |
commit | 0d0dd65a6a227a7c674128bd518a1954b40db408 (patch) | |
tree | f42725ee0df3d2425789d10e1a8639f4cbb25285 /src | |
parent | 0ac9c4276fe78134fedf8d8a2285d67577d15931 (diff) | |
download | bun-0d0dd65a6a227a7c674128bd518a1954b40db408.tar.gz bun-0d0dd65a6a227a7c674128bd518a1954b40db408.tar.zst bun-0d0dd65a6a227a7c674128bd518a1954b40db408.zip |
[bun bun] Fix error when regenerating node_modules.bun after moving it
I think @alii reported this awhile ago
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/bun_command.zig | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cli/bun_command.zig b/src/cli/bun_command.zig index 58fe6fd93..a0f7da655 100644 --- a/src/cli/bun_command.zig +++ b/src/cli/bun_command.zig @@ -100,7 +100,23 @@ pub const BunCommand = struct { this_bundler.configureLinker(); var filepath: [*:0]const u8 = "node_modules.bun"; var server_bundle_filepath: [*:0]const u8 = "node_modules.server.bun"; - try this_bundler.configureRouter(true); + + // This step is optional + // If it fails for any reason, ignore it and continue bundling + // This is partially a workaround for the 'error.MissingRoutesDir' error + this_bundler.configureRouter(true) catch { + this_bundler.options.routes.routes_enabled = false; + this_bundler.options.framework = null; + if (this_bundler.router) |*router| { + router.config.routes_enabled = false; + router.config.single_page_app_routing = false; + router.config.static_dir_enabled = false; + this_bundler.router = null; + } + this_bundler.options.node_modules_bundle = null; + this_bundler.options.node_modules_bundle_pretty_path = ""; + this_bundler.options.node_modules_bundle_url = ""; + }; var loaded_route_config: ?Api.LoadedRouteConfig = brk: { if (this_bundler.options.routes.routes_enabled) { |