From b48de8b0a233a907482a01f7d2992ac30aa02ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 25 Nov 2020 08:37:44 +0100 Subject: [PATCH] Update js.md --- content/en/hugo-pipes/js.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/hugo-pipes/js.md b/content/en/hugo-pipes/js.md index 6b336624a..fd8697264 100644 --- a/content/en/hugo-pipes/js.md +++ b/content/en/hugo-pipes/js.md @@ -102,7 +102,7 @@ For other files (e.g. `JSON`, `CSS`) you need to use the relative path including import * as data from 'my/module/data.json'; ``` -Any imports not matching any component in `/assets` will be resolved by ESBuild with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). +Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported NPM dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. Also note the new `params` option that can be passed from template to your JS files, e.g.: @@ -121,7 +121,7 @@ Hugo will, by default, generate a `assets/jsconfig.js` file that maps the import ### Include Dependencies In package.json / node_modules -Hugo will, as described above, first look for a JS component in the comosite `/assets` filesystem. If not found there, it will fall back to [ESBuild](https://esbuild.github.io/)'s resolve order. If you have any imported NPM dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. +Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported NPM dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. {{< new-in "0.78.1" >}} From Hugo `0.78.1` the start directory for resolving NPM packages (aka. packages that live inside a `node_modules` folder) is always the main project folder.