ChristopherKRad
I’m having some difficulty adding the npm package “three” to my phx project.
Specifically, I am getting blank screen on the /3D route that I have set, however, I am getting the hello word. The div seems to be recognized, but I think there may be something wrong with esbuild?
I’ve tried vendoring three.js using the minified link here with no luck either: https://raw.githubusercontent.com/mrdoob/three.js/dev/build/three.min.js
My current config can be found in the image attached.
I am more familiar with Phx Backend than front end, but would still consider myself a beginner - especially as it relates to adding JS deps.
Any help is appreciated ![]()
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming












Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
03juan
Hi Christopher, welcome to the forum.
The screen grab is too low res to see anything, it would be better if you posted the relevant code directly as text.
ChristopherKRad
oops! You’re right.
Let me try that again
ChristopherKRad
Updated the image
ChrisYammine
it looks like your func createThreeJSScene is never called, have you tried invoking it?
ChristopherKRad
I ended up vendoring three js in
assets/vendor/three.min.jsThen I created a Hook in my
app.jsas follows:Then tried calling the phx-hook in my
three_js_live.exas follows:At the moment, the only thing that renders is the
Hello World03juan
This won’t succeed because it returns
undefinedwhen the attribute is missing.However you also will need to add
phx-update="ignore"to the element, otherwise your scene will be removed on the next update from the server.DOM patching & temporary assigns
ChristopherKRad
So, I’ve reduce the mounted() it down to:
added the following to the
Still no cube unfortunately.
03juan
Import from
three.module.jsI’m curious what version of Phoenix you’re using, since you’re rendering the view with a
~Lleex sigil instead of~H? Did you not get something like this error during the asset build pipeline?ChristopherKRad
I’m running 0.17.5 Live view & 1.6.13 Phoenix.
I do not see such an error on my side.
Is it possible for me to view the project you’ve created so that I can figure out what went wrong on my end?
03juan
Here’s a link to my github repo 03juan/three_cube
My previous answer was actually misleading, sorry about that. I actually got the error after installing the
threemodule from npm into the vendor directory, and then importing from../vendor/node_modules/three/build/three.min.js, not directly from../vendor/three.min.js. I assumed that the error would also show in the second case but didn’t check before posting.Have a look at
app.jsin the repo. In its current state importing fromnode_modulesI get the error when building the asset, and there is no cube. However using the import in the second line does show the cube, and the console only shows the warning:Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternativesI tried to build the bundle with esbuild
0.14.29used in Phoenix1.6.13and that also works when importingthree.min.jsdirectly fromvendorbut not from withinnode_modules.Not sure why it works with one but not the other. My guess is something to do with it being a inside node package, but don’t have enough experience with js bundling to really know.