aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-12-22 20:46:19 +0100
committerBjørn Erik Pedersen <[email protected]>2024-12-22 21:29:18 +0100
commit020253904f335643ead1c390f9fa52f24b185a3d (patch)
treec89e970e366a2e5191655d8a4919c1461d07d4c2 /internal
parent4a5e94087ba2fe1405ad2edbcbeeccac2a6147a6 (diff)
downloadhugo-020253904f335643ead1c390f9fa52f24b185a3d.tar.gz
hugo-020253904f335643ead1c390f9fa52f24b185a3d.zip
js/esbuild: Don't try to resolve packages in /assets marked as external
Fixes #13183
Diffstat (limited to 'internal')
-rw-r--r--internal/js/esbuild/resolve.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/js/esbuild/resolve.go b/internal/js/esbuild/resolve.go
index ac0010da9..8ceec97ef 100644
--- a/internal/js/esbuild/resolve.go
+++ b/internal/js/esbuild/resolve.go
@@ -167,6 +167,17 @@ func createBuildPlugins(rs *resources.Spec, assetsResolver *fsResolver, depsMana
}
}
+ for _, ext := range opts.Externals {
+ // ESBuild will do a more thorough check for packages resolved in node_modules,
+ // but we need to make sure that we don't try to resolve these in the /assets folder.
+ if ext == impPath {
+ return api.OnResolveResult{
+ Path: impPath,
+ External: true,
+ }, nil
+ }
+ }
+
if opts.ImportOnResolveFunc != nil {
if s := opts.ImportOnResolveFunc(impPath, args); s != "" {
return api.OnResolveResult{Path: s, Namespace: NsHugoImportResolveFunc}, nil