-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Description
Description and steps to reproduce
Under assets, I have a JS file script.js with contents
import '/external.js';The file external.js has contents
console.log('This file should not be bundled!');In my template, the script is included as follows:
{{- /* Make sure the resource "external.js" is published. */}}
{{- (resources.Get "external.js").Publish }}
{{- $script := resources.Get "script.js" }}
{{- $opts := dict "format" "esm"
"externals" (slice "/external.js")
}}
{{- $script = $script | js.Build $opts }}
<script type="module" src="{{ $script.Permalink }}"></script>Actual behaviour
The externals option seems to have no effect, and the file external.js is included in the bundled script.js. The bundled file looks as follows:
// ns-hugo-imp:/home/rnwst/src/hugo-test/assets/external.js
console.log("This file should not be bundled!");Expected behaviour
external.js should not be bundled, and the import statement in script.js should be left untouched.
What version of Hugo are you using (hugo version)?
$ hugo version hugo v0.140.0+extended linux/amd64 BuildDate=unknown