hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

index.md (2716B)

    1 
    2 ---
    3 date: 2020-11-03
    4 title: "Hugo 0.78.0: Full Hugo Modules Support in js.Build"
    5 description: "Resolve JavaScript imports top-down in the layered filesystem, pass parameters from template to JS, new JS intellisense helper, improved JS build errors."
    6 categories: ["Releases"]
    7 ---
    8 
    9 This release finally brings full [Hugo Modules](https://gohugo.io/hugo-modules/) support to [js.Build](https://gohugo.io/hugo-pipes/js/), curtsy of he new plugin API in the really, really fast [ESBuild](https://github.com/evanw/esbuild) by [@evanw](https://github.com/evanw).
   10 
   11 Some notes on the improvements in this release:
   12 
   13 * Now `js.Build` fully supports the virtual union filesystem in [Hugo Modules](https://gohugo.io/hugo-modules/). Any import inside your JavaScript components will resolve starting from the top component mount inside `/assets` with a fallback to the traditional "JS way" (`node_modules` etc.)
   14 * You can now pass configuration data from the templates to your scripts via a new `params` option.
   15 * Hugo now writes a `jsconfig.json` file inside `/assets` (you can turn it off) with import mappings to help editors such as VS Code with intellisense/navigation, which is especially useful when there is no common root and the source lives inside some temporary directory.
   16 * We have also improved the build errors you get from `js.Build`. In server mode you will get a preview of the failing lines and in the console you will get a link to the location.
   17 
   18 Read more about this in [the documentation](https://gohugo.io/hugo-pipes/js/), but a short usage example would look like:
   19 
   20 In the template:
   21 
   22 ```go-html-template
   23 {{ $js := resources.Get "js/main.js" | js.Build (dict "params" (dict "api" "https://example.org/api" ) }}
   24 ```
   25 
   26 And then in a JavaScript component:
   27 
   28 ```js
   29 import * as params from '@params';
   30 
   31 // Will resolve to one of `hello.{js,ts,tsx,jsx}` inside `assets/my/module`.
   32 import { hello } from 'my/module/hello';
   33 
   34 var api = params.api;
   35 
   36 hello();
   37 
   38 ```
   39 
   40 ## Changes
   41 
   42 * Add avoidTDZ option [3b2fe3cd](https://github.com/gohugoio/hugo/commit/3b2fe3cd33b74166c3debec9826826f2b5a54fd9) [@bep](https://github.com/bep) [#7865](https://github.com/gohugoio/hugo/issues/7865)
   43 * Make js.Build fully support modules [85e4dd73](https://github.com/gohugoio/hugo/commit/85e4dd7370eae97ae367e596aa6a10ba42fd4b7c) [@bep](https://github.com/bep) [#7816](https://github.com/gohugoio/hugo/issues/7816)[#7777](https://github.com/gohugoio/hugo/issues/7777)[#7916](https://github.com/gohugoio/hugo/issues/7916)
   44 * Generate tsconfig files [3089fc0b](https://github.com/gohugoio/hugo/commit/3089fc0ba171be14670b19439bc2eab6b077b6c3) [@richtera](https://github.com/richtera) [#7777](https://github.com/gohugoio/hugo/issues/7777)
   45 
   46 
   47 
   48 
   49 
   50