1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

js: Add Shims option

This commit adds a new `shims` option to `js.Build` that allows swapping out a component with another.

Fixes #8165
This commit is contained in:
Bjørn Erik Pedersen
2021-01-21 16:52:32 +01:00
parent a1fe552fc9
commit e19a046c4b
3 changed files with 46 additions and 35 deletions

View File

@@ -187,7 +187,7 @@ path="github.com/gohugoio/hugoTestProjectJSModImports"
go 1.15
require github.com/gohugoio/hugoTestProjectJSModImports v0.5.0 // indirect
require github.com/gohugoio/hugoTestProjectJSModImports v0.8.0 // indirect
`)
@@ -215,4 +215,9 @@ Hello3 from mod2. Date from date-fns: ${today}
Hello from lib in the main project
Hello5 from mod2.
var myparam = "Hugo Rocks!";`)
// React JSX, verify the shimming.
b.AssertFileContent("public/js/like.js", `@v0.8.0/assets/js/shims/react.js
module.exports = window.ReactDOM;
`)
}