fxgn
Installing JS dependencies through mix
According to Asset Management — Phoenix v1.8.7, it’s possible to install JS dependencies without relying on npm, by adding them as git dependencies with app: false, compile: false in mix.exs. I tried to do that to install phoenix-custom-event-hook by adding this dependency to my mix.exs:
{:phoenix_custom_event_hook,
github: "launchscout/phoenix-custom-event-hook",
ref: "1d31e36f437d340203e7b952e5fd201c3c841943",
app: false,
compile: false,
depth: 1},
When I run mix deps.get, I see that it’s successfully cloned. However, when I then try to import it in app.js, I just get a build error:
// I tried both of those options separately, neither worked
import PhoenixCustomEventHook from 'phoenix_custom_event_hook';
import PhoenixCustomEventHook from 'phoenix-custom-event-hook';
[watch] build started (change: "js/app.js")
✘ [ERROR] Could not resolve "phoenix-custom-event-hook"
js/app.js:28:35:
28 │ import PhoenixCustomEventHook from 'phoenix-custom-event-hook';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "phoenix-custom-event-hook" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
How do I resolve this? According to the documentation, I should just be able to import them as normal, so why isn’t it working?
First Post!
LostKobrakai
The package.json mentions dist/* files, but those do not exist on the github repo. This still depends on the repo being a proper npm package with all files available.
0
Popular in Questions
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Other popular topics
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









