aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-22 16:59:30 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-22 16:59:54 -0700
commitbfaf095c2ed2ba1f0cd35f1658e2babee8b51985 (patch)
treeb8bce272343c861b74c413a0859549eb7e112191 /src
parentb17b61b8c6854657177dbdc23fad8ea98f4e779f (diff)
downloadbun-bfaf095c2ed2ba1f0cd35f1658e2babee8b51985.tar.gz
bun-bfaf095c2ed2ba1f0cd35f1658e2babee8b51985.tar.zst
bun-bfaf095c2ed2ba1f0cd35f1658e2babee8b51985.zip
Fixes https://discord.com/channels/876711213126520882/1131175053409656833/1131175053409656833
@tr1ckydev this fixes the issue you ran into, see the diff for an example usage of a Bun.plugin that makes a network request on import.
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/module_loader.zig14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig
index b5d2bdcc7..7543d5b80 100644
--- a/src/bun.js/module_loader.zig
+++ b/src/bun.js/module_loader.zig
@@ -1525,12 +1525,14 @@ pub const ModuleLoader = struct {
var slice = slice_;
if (slice.len == 0) return slice;
var was_http = false;
- if (strings.hasPrefixComptime(slice, "https://")) {
- slice = slice["https://".len..];
- was_http = true;
- } else if (strings.hasPrefixComptime(slice, "http://")) {
- slice = slice["http://".len..];
- was_http = true;
+ if (jsc_vm.bundler.options.serve) {
+ if (strings.hasPrefixComptime(slice, "https://")) {
+ slice = slice["https://".len..];
+ was_http = true;
+ } else if (strings.hasPrefixComptime(slice, "http://")) {
+ slice = slice["http://".len..];
+ was_http = true;
+ }
}
if (strings.hasPrefix(slice, jsc_vm.origin.host)) {