mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Add .Defines to js.Build options
This is needed to import `react` as a library, e.g.: ``` {{ $jsx := resources.Get "index.jsx" }} {{ $options := dict "defines" (dict "process.env.NODE_ENV" "\"development\"") }} {{ $js := $jsx | js.Build $options }} ``` Fixes #7489
This commit is contained in:
@@ -42,6 +42,7 @@ func TestToInternalOptions(t *testing.T) {
|
||||
JSXFactory: "v3",
|
||||
JSXFragment: "v4",
|
||||
Externals: []string{"react"},
|
||||
Defines: map[string]interface{}{"process.env.NODE_ENV": "production"},
|
||||
Minify: true,
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ func TestToInternalOptions(t *testing.T) {
|
||||
JSXFactory: "v3",
|
||||
JSXFragment: "v4",
|
||||
Externals: []string{"react"},
|
||||
Defines: nil,
|
||||
Defines: map[string]string{"process.env.NODE_ENV": "production"},
|
||||
TSConfig: "",
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user