Phoenix (& Live View) Sourcemaps

150 views
Skip to first unread message

Jonatan Männchen

unread,
Mar 22, 2021, 8:32:17 AM3/22/21
to phoenix-core
Hi All,

I think it would be very helpful to add Sourcemaps all released & minified JS files. (Phoenix & Phoenix Live View "priv/static")

The reason for this request is that my company is running Phoenix Live View in production with almost no extra JS and we're getting quite a few JS error reports via Sentry.

We're uploading our own Release Sourcemaps to Sentry, but since the phoenix Sourcemaps are not present, we only see the stacktrace in a minified file.

This makes it hard to find the cause of the issue.

Making this change would allow me to find the causes of the issues and report them back to Phoenix so that they can be fixed.

If this reaches a consensus, I'm happy to provide a PR to change Webpack configs etc.

Thanks & Best,
Jony


Jonatan Männchen

unread,
Mar 25, 2021, 6:22:43 AM3/25/21
to phoenix-core
I have a collection of errors in our production sentry.

They all look similar to this:

TypeError: Cannot convert undefined or null to object
  at destroy(../deps/phoenix_live_view/priv/static/phoenix_live_view.js:1:51006)
  at reloadWithJitter(../deps/phoenix_live_view/priv/static/phoenix_live_view.js:1:24003)
  at callback(../deps/phoenix_live_view/priv/static/phoenix_live_view.js:1:23507)
  at ? (../deps/phoenix/priv/static/phoenix.js:1:4779)
  at Array.forEach(<anonymous>)
  at matchReceive(../deps/phoenix/priv/static/phoenix.js:1:4749)
  at callback(../deps/phoenix/priv/static/phoenix.js:1:5257)
  at trigger(../deps/phoenix/priv/static/phoenix.js:1:9625)
  at trigger(../deps/phoenix/priv/static/phoenix.js:1:5501)
  at apply(../deps/phoenix/priv/static/phoenix.js:1:5319)

Having Sourcemaps for those files would greatly improve my ability to diagnose those errors and open Bug Reports / Fix PRs for them.

José Valim

unread,
Mar 25, 2021, 6:43:22 AM3/25/21
to phoeni...@googlegroups.com
I am probably out of my depth here but, when using live view as a dependency, isn't it possible for you to reach out to the one in the assets directory and bundle it instead? Or is that only for git dependencies?

Furthermore, if we ship it with source maps in priv, will you be able to include it in the bundle?

In any case, I think we should make this possible, so PRs along these lines are definitely welcome.

--
You received this message because you are subscribed to the Google Groups "phoenix-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-core...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-core/212ce287-fd36-4044-8128-bfb07a3daa17n%40googlegroups.com.

Jonatan Männchen

unread,
Mar 25, 2021, 7:00:12 AM3/25/21
to phoeni...@googlegroups.com
Using the one in the assets folder is possible if morphdom is added as a dependency.

It is my understanding that at least webpack picks up sorcemaps from dependencies, but I would verify that if I do a PR.

Generally I think it's a good practice to include sourcemaps in any case.

I'll open a PR then 🙂

Sent from my iPhone

On 25 Mar 2021, at 10:43, José Valim <jose....@dashbit.co> wrote:


You received this message because you are subscribed to a topic in the Google Groups "phoenix-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phoenix-core/Dk2AbXVnzeg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phoenix-core...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-core/CAGnRm4LTjZk-9%2BHYB8swgKnAQ2uX6UWbF-qeNB3Fuqy78vpRTg%40mail.gmail.com.

Jonatan Männchen

unread,
Mar 25, 2021, 7:19:24 AM3/25/21
to phoenix-core
I've successfully verified that webpack indeed picks up the sourcemaps.


Including the file directly from assets is theoretically possible, but for that, the PR https://github.com/phoenixframework/phoenix_live_view/pull/1369 by @tylersamples would be required.

José Valim

unread,
Mar 25, 2021, 7:36:10 AM3/25/21
to phoeni...@googlegroups.com
Fantastic, thank you!

Jonatan Männchen

unread,
Apr 27, 2021, 10:18:28 AM4/27/21
to phoenix-core
Is there anything I should do to get the PRs merged?
Reply all
Reply to author
Forward
0 new messages