Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Hugo work with ESBuild >= 0.8.21 #8189

Closed
anthonyfok opened this issue Jan 30, 2021 · 2 comments · Fixed by #8198
Closed

Make Hugo work with ESBuild >= 0.8.21 #8189

anthonyfok opened this issue Jan 30, 2021 · 2 comments · Fixed by #8198
Labels

Comments

@anthonyfok
Copy link
Member

anthonyfok commented Jan 30, 2021

ESBuild 0.8.21 fixed evanw/esbuild#546 (Plugins don't seem to apply to entrypoints) in evanw/esbuild@05eaca4 (fix # 546: plugins now apply to entry points):

On-resolve plugins now apply to entry points (# 546)

Previously entry points were required to already be resolved to valid file system paths. This meant that on-resolve plugins didn't run, which breaks certain workflows. Now entry point paths are resolved using normal import resolution rules.

To avoid making this a breaking change, there is now special behavior for entry point path resolution. If the entry point path exists relative to the current working directory and the path does not start with ./ or ../, esbuild will now automatically insert a leading ./ at the start of the path to prevent the path from being interpreted as a node_modules package path. This is only done if the file actually exists to avoid introducing ./ for paths with special plugin-specific syntax.

... which unfortunately did introduced a breaking change:

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"

See #8105 ("Do not merge: deps: Update to ESBuild v0.8.27") and the failed TestJSBuildWithNPM and TestJSBuild tests on GitHub Actions: https://github.com/gohugoio/hugo/runs/1627365570?check_suite_focus=true

See also #8141 (where Debian build of hugo_0.80.0-1 was broken due to premature building with ESBuild 0.8.28) for more information.

I am starting to study resource_transformers/js/build.go and/or resource_transformers/js/options.go in Hugo. Hope I can get it to work! :-)

@bep
Copy link
Member

bep commented Feb 1, 2021

Looks like an upstream bug:

evanw/esbuild#736

We could probably fix this on the Hugo side by doing some ... guessing, but ...

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants