Why phantomjs does not load HTML page with <script type="module">?

34 Views Asked by At

I have a page (https://example.com/obj_renderer) that contains something like this:

<html>
    <head>
        <script type="module" src="https://example.com/myobjt.js"></script>
        <script type="module">
            MY_OBJ.execute();
        </script>
    </head>
    <body>
        <div id="render_container"></div>
    </body>
</html>

This page runs at same site (example.com) from what I'm importing. This works fine on browser, but when I open this page (https://example.com/obj_renderer) on phantomjs to print it returns blank screen.

If I replace with <script>document.write('test')</script> works fine, the image is generated, so is not and issue with the phantomjs screenshot code.

I can't use require() instead of modules, since it does not work either. Does phantomjs support it? Or could be an issue on my imported js (can't share the code here)?

0

There are 0 best solutions below