Repository: gohugoio/hugo (language: go)

Issue:
Panic when I using `--minify` parameter or set `minify.minifyOutput` to true
<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Hugo are you using (`hugo version`)?
0.102.1

<pre>
$ hugo version
hugo v0.102.1-e9c3ce16abc391ee5be38f88b0499d0e8e19104c+extended linux/amd64 BuildDate=2022-08-29T12:58:13Z VendorInfo=gohugoio
</pre>

### Does this issue reproduce with the latest release?
Yes

Previous version (v0.101.0) is able to generate my website without any errors. But both v0.102.0 and v0.102.1 throw the invalid memory address or nil pointer dereference error:

```plain
$ hugo server --gc --renderToDisk
hugo: collected modules in 555 ms
Start building sites …
hugo v0.102.1-e9c3ce16abc391ee5be38f88b0499d0e8e19104c+extended linux/amd64 BuildDate=2022-08-29T12:58:13Z VendorInfo=gohugoio
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x125c1ea]

goroutine 126 [running]:
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839be8?, 0x0?}, 0x10)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:862 +0x212a
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839468?, 0xc0014a1530?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:961 +0xba6
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x28395e8?, 0xc001438ab0?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1270 +0x184e
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839888?, 0xc000951380?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1086 +0x1745
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839618?, 0xc0014a1590?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1230 +0x2ab
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc000c6cd58, {0x2839a98?, 0xc0009513a0?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:183 +0x1259
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyBlockStmt(0xc000c6cd58, 0xc00149d638)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:416 +0x108
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyFuncDecl(0xc000c6cd58, 0xc00149d600, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:615 +0x30b
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839828?, 0xc00149d600?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1242 +0x1030
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839468?, 0xc0014a15c0?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:995 +0xd9d
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc000c6cd58, {0x2839768?, 0xc0009513d0?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:138 +0x1765
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyBlockStmt(0xc000c6cd58, 0xc00149d588)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:416 +0x108
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyFuncDecl(0xc000c6cd58, 0xc00149d550, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:615 +0x30b
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839828?, 0xc00149d550?}, 0x11)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1242 +0x1030
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839888?, 0xc000951460?}, 0x11)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1081 +0x16ed
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x28396d8?, 0xc00149fd80?}, 0x11)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1053 +0x1125
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839558?, 0xc0014a1650?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1185 +0x5ba
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc000c6cd58, {0x2839768?, 0xc000951470?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:138 +0x1765
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyBlockStmt(0xc000c6cd58, 0xc00149d428)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:416 +0x108
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyFuncDecl(0xc000c6cd58, 0xc00149d3f0, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:615 +0x30b
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839828?, 0xc00149d3f0?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1242 +0x1030
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839408?, 0xc00175ba58?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1101 +0x1eff
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyArguments(0xc000c6cd58?, {{0xc00106c240?, 0xc000a51b80?, 0x11?}})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:520 +0x145
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839558?, 0xc002ca6630?}, 0xe)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1191 +0x617
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc000c6cd58, {0x2839b88?, 0xc002c98588?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1028 +0x585
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc000c6cd58, {0x2839768?, 0xc002ca2480?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:138 +0x1765
github.com/tdewolff/minify/v2/js.(*Minifier).Minify(0xc0007a22c8, 0xc000791ef0?, {0x2828ac0, 0xc001638f90}, {0x282bc20?, 0xc001b54540?}, 0x4d557f?)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:63 +0x238
github.com/tdewolff/minify/v2.(*M).MinifyMimetype(0xc0002a9b00, {0xc001613410, 0x16, 0x16}, {0x2828ac0, 0xc001638f90}, {0x282bc20, 0xc001b54540}, 0x0?)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/minify.go:210 +0x17c
github.com/tdewolff/minify/v2/html.(*Minifier).Minify(0xc0007a2628, 0xc0002a9b00, {0x2828ac0, 0xc001638f90}, {0x2828a80, 0xc001b60750}, 0x2187d00?)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/html/html.go:139 +0x1026
github.com/tdewolff/minify/v2.MinifierFunc.Minify(...)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/minify.go:41
github.com/gohugoio/hugo/minifiers.Client.Transformer.func1({0x28353c8?, 0xc0000f0e10?})
        /root/project/hugo/minifiers/minifiers.go:51 +0xa3
github.com/gohugoio/hugo/transform.(*Chain).Apply(0xc000c6d6e0, {0x2828ac0, 0xc000821d70}, {0x2828a80, 0xc001638fc0})
        /root/project/hugo/transform/chain.go:108 +0x3af
github.com/gohugoio/hugo/publisher.DestinationPublisher.Publish({{_, _}, {_, _}, _}, {{0x2828a80, 0xc001638fc0}, {{0x218619b, 0x4}, {{0x2187dcf, ...}, ...}, ...}, ...})
        /root/project/hugo/publisher/publisher.go:107 +0x1a5
github.com/gohugoio/hugo/hugolib.(*Site).renderAndWritePage(0xc0003ff680, 0xc0006498c0, {0xc001705f80, 0x22}, {0xc0000fb340, 0x9}, 0xc000a0eba0, {0x2835378, 0xc0006582d0})
        /root/project/hugo/hugolib/site.go:1777 +0x795
github.com/gohugoio/hugo/hugolib.pageRenderer(0x115e265?, 0xc0003ff680, 0xc00008ffd0?, 0x115e1e6?, 0xc000619170?)
        /root/project/hugo/hugolib/site_render.go:138 +0x287
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
        /root/project/hugo/hugolib/site_render.go:74 +0x108
```

This error happens when I using `--minify` parameter or set `minify.minifyOutput` to `true` in site configuration.

Here is my site source to reproduce this issue: https://github.com/FarrelF/Blog


Discussion / hints:
Thanks for raising this issue. Is there a way to show which file it was parsing when it failed, like a verbose switch? And secondly, it seems you are running an old version of minify, would it be possible to try and run it with the latest version of tdewolff/parse and tdewolff/minify?
> Thanks for raising this issue. Is there a way to show which file it was parsing when it failed, like a verbose switch? And secondly, it seems you are running an old version of minify, would it be possible to try and run it with the latest version of tdewolff/parse and tdewolff/minify?

@tdewolff Sorry, I think you just send it to wrong issue? Because I don't understand what 'verbose switch' meaning is, and secondly this version of Hugo includes the latest version available of tdewolff/minify (https://github.com/gohugoio/hugo/commit/369bdf22f8d0f33c2b29e202995af6a10ea1a1b7) and tdewolff/parse (https://github.com/gohugoio/hugo/commit/e88873b80324f037b7de7542df86166c16e8cec2)
The verbose switch: `hugo -v ...`

I've tried running your blog but to no avail. I'm getting the following errors with the latest version of Hugo:

```
WARN 2022/08/30 12:29:39 Module "github.com/FarrelF/Blog" is not compatible with this Hugo version; run "hugo mod graph" for more information.
WARN 2022/08/30 12:29:39 Module "github.com/CaiJimmy/hugo-theme-stack/v3" is not compatible with this Hugo version; run "hugo mod graph" for more information.
```
and I get lots of
```
ERROR 2022/08/30 12:29:58 TOCSS: failed to transform "scss/style.scss" (text/x-scss). Check your Hugo installation; you need the extended version to build SCSS/SASS.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information
```

Trying to install the extended version installs Hugo v0.79 which uses an old version of minify. In short, I'm not getting the error you get, I don't even see any JavaScript sources in your repository! Again, what file is causing this error?
@tdewolff 

Please test this simplified project using Hugo v0.102.1.

```bash
git clone --single-branch -b hugo-github-issue-10230 https://github.com/jmooring/hugo-testing hugo-github-issue-10230
cd hugo-github-issue-10230
hugo --minify
```

See lines 14-16 in layouts/_default/home.html

```
{{ with resources.GetRemote "https://cdn.jsdelivr.net/npm/node-vibrant@3.1.6/dist/vibrant.min.js" }}
  <script>{{ .Content | safeJS }}</script>
{{ end }}
```

The error is triggered by trying to minify the (already) minified version of vibrant.js. If you replace those line with this, no problem:

```
{{ with resources.GetRemote "https://cdn.jsdelivr.net/npm/node-vibrant@3.1.6/dist/vibrant.js" }}
  <script>{{ .Content | safeJS }}</script>
{{ end }}
```

But I am not able to reproduce the problem using minify (2.12.0) from the command line.
Thanks @jmooring , I've tried to minify vibrant.min.js with minify@v2.12.0 and minify@v2.11.2 and there seems to be no issue at all. I'm unable to reproduce the bug...
@tdewolff Did you try to build the test project with `hugo --minify`? Did it throw the error?


Yes, with version `v0.102.1`. I get a bunch of errors that features are not available in this version of Hugo, but the extended Hugo version at `v0.79` doesn't build successfully either. It seems that @FarrelF his project doesn't compile.
@tdewolff No, I meant to try this:

```bash
git clone --single-branch -b hugo-github-issue-10230 https://github.com/jmooring/hugo-testing hugo-github-issue-10230
cd hugo-github-issue-10230
hugo --minify
```




Thanks @jmooring, wasn't paying attention hehe. I've managed to bring it down to:

`e?0:(e=1,e=2)`

working on a fix now
> The verbose switch: `hugo -v ...`

Sorry for my late replies. This is my verbose log when I am using a newer version of Hugo Extended:

```plain
$ hugo server -v --gc --renderToDisk
hugo: collected modules in 549 ms
Start building sites …
hugo v0.102.1-e9c3ce16abc391ee5be38f88b0499d0e8e19104c+extended linux/amd64 BuildDate=2022-08-29T12:58:13Z VendorInfo=gohugoio
INFO 2022/08/31 06:59:36 syncing static files to /
INFO 2022/08/31 06:59:38 Data for key 'Vibrant' in path 'external.yaml' is overridden by higher precedence data already in the data tree
INFO 2022/08/31 06:59:38 Data for key 'PhotoSwipe' in path 'external.yaml' is overridden by higher precedence data already in the data tree
INFO 2022/08/31 06:59:38 Data for key 'KaTeX' in path 'external.yaml' is overridden by higher precedence data already in the data tree
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x125c1ea]

goroutine 127 [running]:
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839be8?, 0x0?}, 0x10)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:862 +0x212a
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839468?, 0xc00128f2f0?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:961 +0xba6
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x28395e8?, 0xc00167f0e0?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1270 +0x184e
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839888?, 0xc001455700?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1086 +0x1745
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839618?, 0xc00128f350?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1230 +0x2ab
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc0010a4d58, {0x2839a98?, 0xc001455830?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:183 +0x1259
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyBlockStmt(0xc0010a4d58, 0xc001275c68)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:416 +0x108
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyFuncDecl(0xc0010a4d58, 0xc001275c30, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:615 +0x30b
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839828?, 0xc001275c30?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1242 +0x1030
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839468?, 0xc00128f380?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:995 +0xd9d
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc0010a4d58, {0x2839768?, 0xc001455940?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:138 +0x1765
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyBlockStmt(0xc0010a4d58, 0xc001275bb8)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:416 +0x108
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyFuncDecl(0xc0010a4d58, 0xc001275b80, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:615 +0x30b
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839828?, 0xc001275b80?}, 0x11)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1242 +0x1030
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839888?, 0xc001455af0?}, 0x11)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1081 +0x16ed
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x28396d8?, 0xc00128cbc0?}, 0x11)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1053 +0x1125
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839558?, 0xc00128f410?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1185 +0x5ba
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc0010a4d58, {0x2839768?, 0xc001455b20?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:138 +0x1765
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyBlockStmt(0xc0010a4d58, 0xc001275a58)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:416 +0x108
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyFuncDecl(0xc0010a4d58, 0xc001275a20, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:615 +0x30b
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839828?, 0xc001275a20?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1242 +0x1030
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839408?, 0xc00131e198?}, 0x1)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1101 +0x1eff
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyArguments(0xc0010a4d58?, {{0xc001008360?, 0xc00077a630?, 0x11?}})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:520 +0x145
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839558?, 0xc00167dc80?}, 0xe)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1191 +0x617
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyExpr(0xc0010a4d58, {0x2839b88?, 0xc00177e3c0?}, 0x0)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:1028 +0x585
github.com/tdewolff/minify/v2/js.(*jsMinifier).minifyStmt(0xc0010a4d58, {0x2839768?, 0xc00100a360?})
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:138 +0x1765
github.com/tdewolff/minify/v2/js.(*Minifier).Minify(0xc00001dd08, 0xc0002444e0?, {0x2828ac0, 0xc001234cc0}, {0x282bc20?, 0xc002007f40?}, 0x4d557f?)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/js/js.go:63 +0x238
github.com/tdewolff/minify/v2.(*M).MinifyMimetype(0xc00007f6c0, {0xc001397a70, 0x16, 0x16}, {0x2828ac0, 0xc001234cc0}, {0x282bc20, 0xc002007f40}, 0x0?)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/minify.go:210 +0x17c
github.com/tdewolff/minify/v2/html.(*Minifier).Minify(0xc000332078, 0xc00007f6c0, {0x2828ac0, 0xc001234cc0}, {0x2828a80, 0xc0010068a0}, 0x2187d00?)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/html/html.go:139 +0x1026
github.com/tdewolff/minify/v2.MinifierFunc.Minify(...)
        /root/project/gomodcache/github.com/tdewolff/minify/v2@v2.12.0/minify.go:41
github.com/gohugoio/hugo/minifiers.Client.Transformer.func1({0x28353c8?, 0xc001d99870?})
        /root/project/hugo/minifiers/minifiers.go:51 +0xa3
github.com/gohugoio/hugo/transform.(*Chain).Apply(0xc0010a56e0, {0x2828ac0, 0xc001006cf0}, {0x2828a80, 0xc0013d2570})
        /root/project/hugo/transform/chain.go:108 +0x3af
github.com/gohugoio/hugo/publisher.DestinationPublisher.Publish({{_, _}, {_, _}, _}, {{0x2828a80, 0xc0013d2570}, {{0x218619b, 0x4}, {{0x2187dcf, ...}, ...}, ...}, ...})
        /root/project/hugo/publisher/publisher.go:107 +0x1a5
github.com/gohugoio/hugo/hugolib.(*Site).renderAndWritePage(0xc0000c2000, 0xc00047ab00, {0xc001522420, 0x22}, {0xc0003dbe70, 0x9}, 0xc0012348d0, {0x2835378, 0xc00093d590})
        /root/project/hugo/hugolib/site.go:1777 +0x795
github.com/gohugoio/hugo/hugolib.pageRenderer(0x0?, 0xc0000c2000, 0x0?, 0x0?, 0x0?)
        /root/project/hugo/hugolib/site_render.go:138 +0x287
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
        /root/project/hugo/hugolib/site_render.go:74 +0x108
```

And, this is a verbose log when I am using older Hugo Extended (v0.101.0):
```plain
$ hugo server -v --gc --renderToDisk
hugo: collected modules in 632 ms
Start building sites …
hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended linux/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=gohugoio
INFO 2022/08/31 07:13:58 syncing static files to /
INFO 2022/08/31 07:13:59 Data for key 'Vibrant' in path 'external.yaml' is overridden by higher precedence data already in the data tree
INFO 2022/08/31 07:13:59 Data for key 'PhotoSwipe' in path 'external.yaml' is overridden by higher precedence data already in the data tree
INFO 2022/08/31 07:13:59 Data for key 'KaTeX' in path 'external.yaml' is overridden by higher precedence data already in the data tree

                   |  ID
-------------------+-------
  Pages            |  138
  Paginator pages  |   16
  Non-page files   |  137
  Static files     | 3698
  Processed images |  306
  Aliases          |   73
  Sitemaps         |    1
  Cleaned          |    0

Built in 8598 ms
Watching for changes in /home/farrel/Documents/FarrelF-Blog/{blog_site,stack-modified}
Watching for config changes in /home/farrel/Documents/FarrelF-Blog/blog_site/config/_default, /home/farrel/Documents/FarrelF-Blog/blog_site/config/development, /home/farrel/Documents/FarrelF-Blog/blog_site/go.mod
Environment: "development"
Serving pages from /home/farrel/Documents/FarrelF-Blog/blog_site/public
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
```

I don't know what the problem caused at first, the verbose information above does not help at all.

> I've tried running your blog but to no avail. I'm getting the following errors with the latest version of Hugo:
> 
> ```
> WARN 2022/08/30 12:29:39 Module "github.com/FarrelF/Blog" is not compatible with this Hugo version; run "hugo mod graph" for more information.
> WARN 2022/08/30 12:29:39 Module "github.com/CaiJimmy/hugo-theme-stack/v3" is not compatible with this Hugo version; run "hugo mod graph" for more information.
> ```
> 
> and I get lots of
> 
> ```
> ERROR 2022/08/30 12:29:58 TOCSS: failed to transform "scss/style.scss" (text/x-scss). Check your Hugo installation; you need the extended version to build SCSS/SASS.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn[](https://goo.gl/YMrWcn) for more information
> ```
> 
> Trying to install the extended version installs Hugo v0.79 which uses an old version of minify. In short, I'm not getting the error you get, I don't even see any JavaScript sources in your repository! Again, what file is causing this error?

Sorry for my vagueness because the blog is not in English, this project requires to use Hugo Extended with a minimum version of 0.91.0 that I set on my site configuration and the theme itself requires v0.89.0 of Hugo Extended, so I recommend you to use Hugo Extended v0.101.0 (as I explained at the beginning of the issue) instead of v0.79
Fixed in minify@v2.12.1, thanks for the help @jmooring ! Please wait for a new release of Hugo to get this fixed @FarrelF 

Fix patch:
diff --git a/go.mod b/go.mod
index 3618c4089e0..78647ded37b 100644
--- a/go.mod
+++ b/go.mod
@@ -54,8 +54,8 @@ require (
 	github.com/spf13/fsync v0.9.0
 	github.com/spf13/jwalterweatherman v1.1.0
 	github.com/spf13/pflag v1.0.5
-	github.com/tdewolff/minify/v2 v2.12.0
-	github.com/tdewolff/parse/v2 v2.6.2
+	github.com/tdewolff/minify/v2 v2.12.1
+	github.com/tdewolff/parse/v2 v2.6.3
 	github.com/yuin/goldmark v1.4.13
 	go.uber.org/atomic v1.10.0
 	gocloud.dev v0.24.0
diff --git a/go.sum b/go.sum
index b8b86d86f09..cf0fe01d75b 100644
--- a/go.sum
+++ b/go.sum
@@ -514,12 +514,10 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
-github.com/tdewolff/minify/v2 v2.12.0 h1:ZyvMKeciyR3vzJrK/oHyBcSmpttQ/V+ah7qOqTZclaU=
-github.com/tdewolff/minify/v2 v2.12.0/go.mod h1:8mvf+KglD7XurfvvFZDUYvVURy6bA/r0oTvmakXMnyg=
-github.com/tdewolff/parse/v2 v2.6.1/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho=
-github.com/tdewolff/parse/v2 v2.6.2 h1:RDExtQ7ThRGSucatK0nri3p+HD/tSreYh1IDtDDAS/I=
-github.com/tdewolff/parse/v2 v2.6.2/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
-github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
+github.com/tdewolff/minify/v2 v2.12.1 h1:zcjJTcO0uI+asdT+nd4TjXi3KUmVV/G2kxOKKrgKlGw=
+github.com/tdewolff/minify/v2 v2.12.1/go.mod h1:p5pwbvNs1ghbFED/ZW1towGsnnWwzvM8iz8l0eURi9g=
+github.com/tdewolff/parse/v2 v2.6.3 h1:O5rshbkaRmpRtD7k2lG65bEJpcfUMNg5Cx2uRKWVsI8=
+github.com/tdewolff/parse/v2 v2.6.3/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
 github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM=
 github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
 github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=


Test patch: