larsen / rando-planner

Clerk viewers and utils to plan bikepacking trips
https://rando-planner.stefanorodighiero.net/
4 stars 0 forks source link

sometimes the notebook displays a "Invalid module" error, that spontaneusly goes away when reloading the page #21

Closed larsen closed 5 months ago

larsen commented 5 months ago

The only occurrence of the string Invalid module in the scripts loaded in a notebook page is viewer.js, loaded from this URL: https://storage.clerk.garden/nextjournal/clerk-assets@3mwzShgnuyfhgFN9ahRYKqV32K11/viewer.js?immutable=true

                    kb.onload = ()=>{
                        try {
                            ec(ea.pop()(Ab(Sb)))
                        } catch (Bc) {
                            wc(new Sa("invalid module"))
                        }
                        kb.remove()
                    }

which I believe is the result of merging and minifying several source files. Looking at the code and the context of the error, I believe this is coming from d3-require, where I can see this snippet

      script.onload = () => {
        try { resolve(queue.pop()(requireRelative(url))); }
        catch (error) { reject(new RequireError("invalid module")); }
        script.remove();
      };

that seems analogous.

larsen commented 5 months ago

What module is causing the problem?


A strategy of last resort could be to remove leaflet-gpx entirely, and use a polyline manually to display the track (look for example https://github.com/jovandeginste/workout-tracker/blob/d97718294191e581bb761172b059a8d728127d69/assets/map.js#L21)

larsen commented 5 months ago

Tentatively closing this issue. Let's see if #44 solves or mitigates the problem