webrecorder / pywb

Core Python Web Archiving Toolkit for replay and recording of web archives
https://pypi.python.org/pypi/pywb
GNU General Public License v3.0
1.42k stars 217 forks source link

relative imports in .js are not loaded #883

Open steph-nb opened 9 months ago

steph-nb commented 9 months ago

Expected behavior

The page https://www.kunsthoch-luzern.ch/ (recorded with Heritrix) should be visible

What actually happened

The page https://www.kunsthoch-luzern.ch/ (recorded with Heritrix) stays completely white in the replay with pywb 2.7.4 Whereas the same crawl can be replayed with openwayback...

Assumed cause

Imports in js using relative paths are not getting requested/loaded:

The page uses this js: https://www.kunsthoch-luzern.ch/ressources/js/main.js

which imports these .js:

import {NullSwiper as e} from "./mods/nullswiper.js"; import {ViewportFix as t} from "./helpers/viewportFix.js"; import {ClientInformations as o} from "./helpers/clientInformations.js"; import {EventHandler as r} from "./helpers/eventHandler.js"; import {Simplify as a} from "./helpers/simplify.js"; import {AddNullInteract as n} from "./helpers/nullInteract.js"; import {menuHandler as i} from "./static/menuHandler.js"; import {SubMenu as s} from "./static/submenu.js"; import {Cookie as l} from "./static/cookie.js"; import {Cursor as c} from "./static/cursor.js"; import {MapHandler as m} from "./dynamic/map.js";

With the rewritten form served by pywb which looks like this:

var WB$wombat$assign$function = function(name) { return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.WB_pmw) { self.__WB_pmw = function(obj) { this.WB_source = obj; return this; } } { let window = WB$wombat$assign$function("window"); let self = WB$wombat$assign$function("self"); let document = WB$wombat$assign$function("document"); let location = WB$wombat$assign$function("location"); let top = WB$wombat$assign$function("top"); let parent = WB$wombat$assign$function("parent"); let frames = WB$wombat$assign$function("frames"); let opener = WB$wombat$assign$function("opener"); let arguments;

{
    import {NullSwiper as e} from "./mods/nullswiper.js";
    import {ViewportFix as t} from "./helpers/viewportFix.js";
    import {ClientInformations as o} from "./helpers/clientInformations.js";
    import {EventHandler as r} from "./helpers/eventHandler.js";
    import {Simplify as a} from "./helpers/simplify.js";
    import {AddNullInteract as n} from "./helpers/nullInteract.js";
    import {menuHandler as i} from "./static/menuHandler.js";
    import {SubMenu as s} from "./static/submenu.js";
    import {Cookie as l} from "./static/cookie.js";
    import {Cursor as c} from "./static/cursor.js";
    import {MapHandler as m} from "./dynamic/map.js";
    const u = {
        viewportFix: new t,

...

These js-files are not requested by the browser.

Browser and pywb