Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fix for browser mapping to false together with an onLoad plugin #3151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/bundler/bundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,11 @@ func runOnLoadPlugins(
}
tracker := logger.MakeLineColumnTracker(importSource)

// Force disabled modules to be empty
if source.KeyPath.IsDisabled() {
return loaderPluginResult{loader: config.LoaderEmpty}, true
}

// Apply loader plugins in order until one succeeds
for _, plugin := range plugins {
for _, onLoad := range plugin.OnLoad {
Expand Down Expand Up @@ -965,11 +970,6 @@ func runOnLoadPlugins(
}
}

// Force disabled modules to be empty
if source.KeyPath.IsDisabled() {
return loaderPluginResult{loader: config.LoaderEmpty}, true
}

// Read normal modules from disk
if source.KeyPath.Namespace == "file" {
if contents, err, originalError := fsCache.ReadFile(fs, source.KeyPath.Text); err == nil {
Expand Down