I am attempting to use js.build
in my code, but I’m encountering a “Parsing error: ‘import’ and ‘export’ may appear only with ‘sourceType: module’” in my JavaScript file.
My code:
.HTML
{{ $js := resources.Get "/js/index.js" | js.Build (dict "params" (dict "list" .Site.Params.variable)) }}
.js
import * as params from ‘@params’;
console.log(params.list);
.config.yaml
params:
variable: ["x,y"]
Hugo Vertion: 0.121.1
Have any idea where I made a mistake?