Skip to content

Commit d2d3074

Browse files
committed
properly set NODE_ENV, fix PDF worker bundle URL
1 parent ebaae01 commit d2d3074

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

layouts/partials/scripts.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
{{ $defines
1616
:= dict
17-
"process.env.NODE_ENV" `"development"`
17+
"process.env.NODE_ENV" ((cond .Site.Params.devMode "development" "production") | jsonify)
1818
"global" "window"
1919
}}
2020
{{ $commonJsBuildOptions
@@ -26,7 +26,9 @@
2626
}}
2727

2828
{{ $pdfWorkerBundle := resources.Get "js/Utility/pdf.worker.ts" | js.Build $commonJsBuildOptions }}
29-
{{ $pdfWorkerDefines := dict "defines" (dict "window.PDF_WORKER_URL" ($pdfWorkerBundle.Permalink | jsonify)) }}
29+
<!-- We are using the `RelPermalink` here because otherwise we try to load the worker from the German domain even for
30+
the other languages, which causes cross-origin errors. I don't understand why. -->
31+
{{ $pdfWorkerDefines := dict "defines" (dict "window.PDF_WORKER_URL" ($pdfWorkerBundle.RelPermalink | jsonify)) }}
3032

3133
<!-- Entry points that are included in every page. -->
3234
{{ $errorHandlerBundle := resources.Get "js/error-handler.js" | js.Build (merge $commonJsBuildOptions $pdfWorkerDefines) }}

0 commit comments

Comments
 (0)