External javascript libraries (in my case Quill.js) not resolving when running 'mix assets.deploy' in 'prod' env in phoenix 1.7.0-rc

Hi all,
as per title, I am using newest phoenix version 1.7.0-rc. I am also using Quill.js to support rich text editing. In my quillxy.js file I import quill on the very first line like this: “import Quill from ‘quill’;”. When I run “mix phx.server”, everything works fine, I am able to use rich text, persist it in a database etc. On my Mac, I am able to run “MIX_ENV=prod mix compile” and then “MIX_ENV=prod mix assets.deploy” just fine, but when I run the same commands on my GCP (google cloud platform) Linux virtual machine (debian-11-bullseye-v20220920), I am getting following error when running “MIX_ENV=prod mix assets.deploy”:

✘ [ERROR] Could not resolve "quill"

      1 │ import Quill from 'quill';
        ╵                   ~~~~~~~

  You can mark the path "quill" as external to exclude it from the bundle, which will remove this error.

1 error
** (Mix) `mix esbuild default --minify` exited with 1

I have no clue what I am doing wrong and I will be grateful for any tips, guidance or support.

Thank you all and enjoy your day!:wink:

So I resolved my own problem by reading documentation (here: Asset Management — Phoenix v1.7.0-rc.0) - running npm install quill --save inside my assets directory as per those docs. Then command “MIX_ENV=prod mix assets.deploy” worked fine.

1 Like