silverdr
There doesn’t seem to be much about it in Google’s caches yet so if anyone succeeded (without breaking other stuff
) in the task of integrating Svelte into the esbuild environment of Phoenix 1.6.x, sharing the experience and hints would be 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
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
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
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
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
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #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)
greven
Hey. I haven’t integrated Svelte into my projects, but what is your exact difficulty? Are you trying to avoid using NPM? If so, unless someone pre-packages svelte into an hex package you will have to use NPM, because other than that I don’t see a major difference between integrating Svelte into Phoenix than any other Backend framework.
Unless you mean SvelteKit? That would be pretty much impossible at this stage to integrate other than just using Phoenix for the service side of things (Rest or GraphQL, etc.).
silverdr
I surely would be happy to get rid of node but since it’s there for other reasons anyway, so that’s not about it. It’s about integrating Svelte into the
watch'n buildprocess. IOW - I’d like to have.sveltecomponents built and usable in Phoenix application. Similar to how other “assets” are built on-the-fly as needed indevenvironment. the Mostly for some interactive and reactive widgets here and there. Something what I had for the previous versions. Setup well outlined here: https://dkuku.github.io/phoenix-svelte-setupgreven
So basically the problem is replacing Webpack with esbuild for Svelte.
Because after that is a matter of adding a watcher in the dev config file to watch the npm build process.
Apparently esbuild is not as well supported in svelte as in webpack, it is possible with something like this: GitHub - EMH333/esbuild-svelte: An esbuild plugin to compile Svelte components · GitHub there is also an example of a plugin from evan: can we use Svelte in esbuild? · Issue #8 · evanw/esbuild · GitHub but that is kinda an old issue, don’t know how well it works.
silverdr
Yeah, I found those, plus
https://esbuild.github.io/plugins/#svelte-plugin
but I would appreciate some hints how to correctly plug that into Phoenix/mix
derek-zhou
I use svelte and liveview, just not in the same project. In both cases, I use snowpack, I would imagine that it should have no problem handling both svelte and liveview together. Also, snowpack can optionally use esbuild underneath as a JavaScript minimizer
yendrisrogelio
@silverdr I made this little demo just for educational purposes where I integrate phoenix 1.6, esbuild, svelte and tailwindcss , GitHub - roger120981/svelte_phoenix: Template to integrate phoenix.16, esbuild, svelte and tailwindcss · GitHub , Just a detail in the case of tailwindcss being in a windows 10 environment, I had to make some modifications to the original watcher, but it works perfectly in linux and svelte works well, only that it is a small step for complex apps.
pd: Use esbuild-svelte as a svelte plugin
silverdr
This looks promising, thank you! I’ll have a closer look and report. In my case it is enough if it works with Linux and OSX.
yendrisrogelio
@silverdr ok, I just created and updated a branch that works on linux / osx https://github.com/roger120981/svelte_phoenix/tree/linux-tailwind
silverdr
I did a quick
git clonefollowed bymix deps.getand when trying to run the server I get a few warnings:followed by:
This is on Linux / master branch. If I switch to
linux-tailwindbranch I get:Any quick fixes for that?
yendrisrogelio
In the case of the esbuild error, just install the dependency,
cd assets npm i esbuild, must be above 0.9.6 which is the version that svelte-esbuild needs, in this case it tells you that it cannot find that module because it has not been installedIn the case of elixir I use version
1.12.1,erlang otp 23and it compiles well for windows 10 and for linux with the ubuntu 18.04 distro