hugo: Debian build is broken

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.80.0/extended linux/amd64 BuildDate: 2021-01-01T02:12:40Z

Does this issue reproduce with the latest release?

Yes.

Issues

Javascript building/bundling fails with sources and dependencies all in assets/js. Here is a minimal example I constructed based on the test project linked in the Hugo documentation.

With Hugo 0.80.0 the build fails:

$ hugo version
Hugo Static Site Generator v0.80.0/extended linux/amd64 BuildDate: 2021-01-01T02:12:40Z
$ hugo
Start building sites … 
Total in 12 ms
Error: Error building site: JSBUILD: failed to transform "js/main.js" (application/javascript): "/home/r/hugoTestProjectJSModImports/assets/js/main.js:1:23": Could not resolve "./lib"

While with Hugo 0.79.1 it works as expected:

$ hugo version
Hugo Static Site Generator v0.79.1/extended linux/amd64 BuildDate: 2020-12-22T10:11:47Z
$ hugo
Start building sites … 

                   | EN  
-------------------+-----
  Pages            |  2  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 11 ms

If this is not a regression but intended new behaviour, then the documentation might need further clarification.

BTW: Calling esbuild manually works on the same sources:

esbuild --version
0.8.28
esbuild --bundle --minify --outfile=out.js main.js 
cat out.js 
(()=>{function o(){return"Hello from lib in the main project!!"}console.log("Hello from main entry point.");function l(){console.log(o())}window.hello=l;})();

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

Dear all,

@raoulb, Thank you for reporting the issue, especially timely because Debian 11 (bullseye) will go into freezing soon, and it is good that you let us know of the issue now instead of later.

@bep and @moorereason, thank you both for your excellent investigative work. Indeed, it was my laziness and oversight when updating Debian’s copy of esbuild to a too-new version that led to this issue. Now that @moorereason has found out which version of esbuild (v0.8.21) has the behaviour change, I can start looking into a fix for my Debian build later today. Thank you @moorereason for saving me a lot of time.

Tested the latest esbuild and can confirm that it fails to build your test site with the error message in the OP: Could not resolve "./lib".

@moorereason

I’m unable to reproduce this on my system

Oh, interesting and kind of good news.

Where are you getting your hugo binaries? Can you try the ones in the tar.gz on GH?

Ok. I tried the both versions for the tar.gz files and they work.

$ ~/hugo_0.80.0_Linux-64bit/hugo version
Hugo Static Site Generator v0.80.0-792EF0F4 linux/amd64 BuildDate: 2020-12-31T13:37:58Z
$ ~/hugo_0.80.0_Linux-64bit/hugo 
Start building sites … 

                   | EN  
-------------------+-----
  Pages            |  2  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 10 ms

and

$ ~/hugo_extended_0.80.0_Linux-64bit/hugo version
Hugo Static Site Generator v0.80.0-792EF0F4/extended linux/amd64 BuildDate: 2020-12-31T13:46:18Z
$ ~/hugo_extended_0.80.0_Linux-64bit/hugo 
Start building sites … 

                   | EN  
-------------------+-----
  Pages            |  2  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 9 ms

Now I could try the deb packages provided here on GH if this helps.