The app compiles locally and runs on localhost:4000
but in prod, via fly deploy
, I can’t manage external .js
files in assets
.
The error is
✘ [ERROR] Could not resolve "highlight.js/lib/core"
#21 10.71
#21 10.71 js/highlighter.js:1:17:
#21 10.71 1 │ import hljs from 'highlight.js/lib/core';
#21 10.71 ╵ ~~~~~~~~~~~~~~~~~~~~~~~
#21 10.71
#21 10.71 You can mark the path "highlight.js/lib/core" as external to exclude it from the bundle, which will remove this error.
#21 10.71
How does one include external .js files in assets.deploy
?
My mix.exs
is
defp aliases do
[
"assets.deploy": [
"tailwind default --minify",
"esbuild default --minify",
"phx.digest"
],
setup: [
"deps.get",
"cmd npm --prefix assets install"
]
]
end