hugo
hugo copied to clipboard
Named mounts not working with Hugo’s generated `jsconfig.json`
I have a module for Twitter Bootstrap v5 which mounts js to assets/bootstrap.
The mounts are configured here:
https://github.com/UtkarshVerma/hugo-modules/blob/main/bootstrap-v5/config.yaml
With this configured, I just have to import my Bootstrap plugins like import ScrollSpy from 'bootstrap/src/scrollspy' and my JS gets built successfully.
But I noticed a minor caveat, VS Code fails to resolve my import paths, and I think I know why.
Here is my jsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": [
"*",
"../../../../../tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/[email protected]+incompatible/js/*"
]
}
}
}
The issue is that it is telling VS Code to resolve all import paths relative to js rather than bootstrap/js for the Bootstrap module. A fix for this would be for Hugo to add mount point's target path (relative to assets) and add a key-value pair accordingly in "paths" in jsconfig.json. For example, for this case, jsconfig.json should be like:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": ["*"],
"bootstrap/*": ["../../../../../tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/[email protected]+incompatible/js/*"]
}
}
}
I can confirm that this works.
What do you mean by "named mounts"? How are they different from the mounts that are working?
I meant to imply that the module is not mounted directly to assets, but in its subdirectory.
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
This issue now has a funding of 0.001 ETH (2.4 USD @ $2399.96/ETH) attached to it as part of the @15100899254 fund.
- If you would like to work on this issue you can 'start work' on the Gitcoin Issue Details page.
- Want to chip in? Add your own contribution here.
- Questions? Checkout Gitcoin Help or the Gitcoin's Discord
- $2,239,868.45 more funded OSS Work available on the Gitcoin Issue Explorer
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
Work has been started.
These users each claimed they can complete the work by 265 years, 5 months from now. Please review their action plans below:
1) 15100899254 has started work.
Go it twice,so easy,and fixed it!
Learn more on the Gitcoin Issue Details page.
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
Work for 0.001 ETH has been submitted by:
- Learn more on the Gitcoin Issue Details page
- Want to chip in? Add your own contribution here.
- Questions? Checkout Gitcoin Help or the Gitcoin's Discord
- $2,239,866.05 more funded OSS Work available on the Gitcoin Issue Explorer
@bep Could we please block gitcoinbot as spam? They won't probably realise until 265 years from now.
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
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.