Resources and bundles resources don't work in local development, work fine once deployed

Hey there,

I’m using a few things from NPM (Algolia search, Mermaid.JS, Feather Icons) and I’ve successfully bundled them all together with no issues once deployed.

When running my local hugo server, or even the netlify dev server, things like Mermaid.JS and algolia don’t load on my site.

To reiterate, it’s only on local environments. Once deployed, they work perfectly fine. Obviously this presents a bit of trouble when trying to tweak their settings.

Is there any reason these resources wouldn’t be loading in my local environment?

Maybe because you have somewhere environment (production vs. development) conditions or accordingly splitted config files or…

I think providing a link to your repo might speed up the answer.

Thanks, you were correct.

I solved my issue by linking the dependencies to CDN versions conditionally in the development environment. To do so, I added this to my head.html

<!-- For Local Environment -->
{{ if eq hugo.Environment "development" }}
<script src="URL"></script>
<script type="text/javascript" src="URL"></script>
{{ else }}
{{ end }}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.