-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Consider node_modules in /assets #7966
Comments
This was not an intentional break, but it's hard to guess everyones setup. I have thought long and hard about So, in short, with Hugo 0.78.2 we expect in general that:
So, as to this particular issue, I don't think I could support (in a simple fashion) it even if I wanted to (and I would need some more convincing arguments). |
Understood. I was under the impression this was the default project layout, since layout files resolve from the assets directory. It would make sense that if Also, I'm assuming the |
As to jsconfig.json in /assets. That comes from Hugo (motivated by intellisense, incredibly useful in multi-module setups), you can turn it off: https://gohugo.io/getting-started/configuration/#configure-build The I guess it could make sense to allow I'll keep this issue open for discsussion. |
Oh excellent, didn't realize there was a config option to disable it. Mind if I make a small PR to add that to the Javascript pipeline docs? It's a good thing to be aware of for those of us who don't use intellisense. To answer your question, yes I was putting That being said, I didn't consider how using a theme could complicate this setup. I see where you're coming from. Since my specific use-case can be solved by putting a |
Nevermind on the PR suggestion... noticed that it's already in the documentation and my tired brain just missed it. My mistake. Thanks for your time @bep. |
The ESBuild Javascript pipeline no longer resolves dependencies from the
node_modules
folder if it's located atassets/node_modules
. This is new behavior from a recent release, eitherv0.78
orv0.78.1
. Previously-working builds now result inJSBUILD: 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: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:When I delete this file, it shows right back up on
hugo serve
. If creatingjsconfig.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?
The text was updated successfully, but these errors were encountered: