phoenixframework / phoenix_live_view

Rich, real-time user experiences with server-rendered HTML
https://hex.pm/packages/phoenix_live_view
MIT License
6.18k stars 930 forks source link

`priv/static/phoenix_live_view.js` needs rebuild #217

Closed brianmay closed 5 years ago

brianmay commented 5 years ago

Looks like where I went wrong with #202 was that I hadn't rebuilt priv/static/phoenix_live_view.js file, and as a result applications will use the minified file with the old code (which I believe is still in git).

I thought I had solved this, but my solution caused more problems I think.

Actually wondering if there is any way of using the non-minified version? This would really help with debugging. It should be possible to minify it in the application, and also include the appropriate source map files. However my webpack knowledge is less then ideal.... Not even sure right now how my app is finding priv/static/phoenix_live_view.js.

chrismccord commented 5 years ago

Whenever you mix deps.update phoenix_live_reload, you need to also rm -rf assets/node_modules/phoenix_live_view && npm i --prefix assets.

For local dev, I symlink to the phoenix.js src, and import that locally in my demo app as a relative path, ie:

import LiveSocket form "./phoenix_live_view

Hope that helps! Thanks!

brianmay commented 5 years ago

Whenever you mix deps.update phoenix_live_reload, you need to also rm -rf assets/node_modules/phoenix_live_view && npm i --prefix assets.

Yes, I did this, problem is that this brings in minimized code that doesn't include my changes.

i.e. the minimized code straight from git in priv/static/phoenix_live_view.js contains:

R=function(e){return new URLSearchParams(new FormData(e)).toString()}

Which is the old code. The ./assets/js/phoenix_live_view.js is correct. If I rebuild the js stuff in phoenix_live_view then the minimized javascript is updated and is now correct.

I have tried referring to the phoenix_live_view.js directly (e.g. by symlink as you suggested), but that gives me another error:

Error: Cannot find module "morphdom"