vue.js and safari: a white page every now and then

In Safari a normal vue.js page produced an empty page every now and then for seemingly no reason. Since debugging with iOS is a pain in the ass and only possible through this hack, it took us a while to notice the console error telling us that the #app element was not found.

The index.html looked like this:

<body>    
    <script>
        import('/js/module/bundle.js');
    </script>
    <div id="app">
    </div>
</body>

But Safari wants it the other way around:

<body>    
    <div id="app">
    </div>
    <script>
        import('/js/module/bundle.js');
    </script>
</body>

And then it works.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.