diff --git a/internal/bundler/bundler.go b/internal/bundler/bundler.go index 9d53da34ee1..1e4aeffb895 100644 --- a/internal/bundler/bundler.go +++ b/internal/bundler/bundler.go @@ -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 { @@ -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 {