-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
The ESBuild Javascript pipeline no longer resolves dependencies from the node_modules
folder if it's located at assets/node_modules
. This is new behavior from a recent release, either v0.78
or v0.78.1
. Previously-working builds now result in JSBUILD: failed to transform...Could not resolve "foobar"
.
I was able to fix this by creating a jsconfig.json
at the root of the project with the following:
{
"compilerOptions": {
"baseUrl": "assets",
"paths": {
"*": ["node_modules/*"]
}
}
}
However, this is not well-documented anywhere, either in Hugo or ESBuild.
Another strange behavior: If a Javascript file is importing another local file, assets/jsconfig.json
is automatically created with the following, which doesn't seem to be necessary:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": [
"*"
]
}
}
}
When I delete this file, it shows right back up on hugo serve
. If creating jsconfig.json
at the root of the project solves the above issue, there doesn't seem to be a need to have this redundant file automatically created in the project.
Reproduction Repo
What version of Hugo are you using?
Hugo Static Site Generator v0.78.2/extended darwin/amd64