Closed aiwaiwa closed 1 year ago
Make sure you have live_svelte
as a dependency in your package.json
:
"dependencies": {
"live_svelte": "file:../deps/live_svelte",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"phoenix_live_view": "file:../deps/phoenix_live_view"
}
I think that will fix the last error you're having. Let me know if this works and I'll close the issue.
As for the new esbuild version, it's something I'm aware of but haven't gotten around to fixing yet, the issue is being tracked here https://github.com/woutdp/live_svelte/issues/29. The reason was that it wasn't working on fly.io for some reason for me. This might be specific to me though. Feel free to use the latest version esbuild in your own setup if it works for you!
I'll be using live_svelte in production probably in the coming weeks, I'll experiment with the latest version of esbuild and if it works then I'll be updating the esbuild in LiveSvelte.
Happy you're enjoying the project :)
Hey thank you, adding "live_svelte"
made it at lease pass the error compilation stage!
I ended up having this config:
"dependencies": {
"esbuild": "^0.17.19",
"live_svelte": "file:../deps/live_svelte",
> "esbuild-svelte": "^0.7.3",
> "esbuild-plugin-import-glob": "^0.1.1",
> "svelte-preprocess": "^5.0.4",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"phoenix_live_view": "file:../deps/phoenix_live_view"
}
Without esbuild-svelte
I encounter:
iex> [error] Task #PID<0.734.0> started from ProjectWeb.Endpoint terminating
** (stop) :watcher_command_error
(phoenix 1.7.2) lib/phoenix/endpoint/watcher.ex:55: Phoenix.Endpoint.Watcher.watch/2
(elixir 1.14.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Function: &Phoenix.Endpoint.Watcher.watch/2
Args: ["node", ["build.js", "--watch", {:cd, "c:/Users/user/Desktop/Projects/project/assets"}]]
iex> node:internal/modules/cjs/loader:1085
throw err;
^
Error: Cannot find module 'esbuild-svelte'
Require stack:
- c:\Users\user\Desktop\Projects\project\assets\build.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
at Module._load (node:internal/modules/cjs/loader:928:27)
at Module.require (node:internal/modules/cjs/loader:1149:19)
at require (node:internal/modules/helpers:121:18)
at Object.<anonymous> (c:\Users\user\Desktop\Projects\project\assets\build.js:2:22)
at Module._compile (node:internal/modules/cjs/loader:1267:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'c:\\Users\\user\\Desktop\\Projects\\project\\assets\\build.js' ]
}
You do need esbuild-svelte
Here's an example of a package.json file: https://github.com/woutdp/live_svelte/blob/master/example_project/assets/package.json#L7
Thank you!
esbuild
broke the way build works starting with0.17.0
and I'm trying to make it work withlive_svelte
.esbuild
"^0.17.19"I did a bit of fiddling and tried to:
optClient
andoptsServer
inbuild.js
:(I know I would want to use "await" but esbuild is not happy that it's top-level)
I also ended up adding a bunch of dependencies to
package.json
not mentioned in the README:I feel I'm close. The only error I'm getting is this one:
So I wonder if there's any hints for me. I love where this project is going VERY much! Now I would love it to actually work too 🥇