In the past, it has been used normally, and the js files can be merged in the order of 1 2 3 as expected, but not in the expected order, resulting in some errors (the method is not initialized).
Specifically starting from the last few versions, I am not sure whether it is caused by version updates. I have tested several versions and there is no answer.
In the previous normal expectation, the merging order was that the files in the relevant directories were loaded in alphabetical order, with the root directory being merged first, followed by the js files in the secondary folders being merged in alphabetical order of the file names.
This is not the order now, so the common.js file in the root directory, which should have the highest priority, is not at the beginning of the merged file.
Please tell me how to control the order of file merging through explicit code when merging files?
{{- $commonJs := partial "functions/concat" (dict "concatPath" "static/js/common/**.js" "targetPath" "static/js/common.bundle.js") }}
<script src="{{ $commonJs }}"></script>
{{/* https://gohugo.io/hugo-pipes/bundling/ */}}
{{ $concatPath := .concatPath }}
{{ $targetPath := .targetPath }}
{{ $bundle := resources.Match $concatPath | resources.Concat $targetPath }}
{{ if hugo.IsProduction }}
{{ $bundle = $bundle | resources.Minify }}
{{ end }}
{{ return ($bundle.Permalink | relURL) }}
I have read the following documents and there is no introduction to controlling sorting.