github io cannot load javascript in html with type set on module

Viewed 19

I have committed my code to github and usually I can see my uploaded html page using htmlpreview.github.io but if I use javascript code with a module type:

<script type = "module" src = "./src/main.js"></script>

The page cannot be loaded because htmlpreview.github.io does not regard the type of script. The preview loads my html as plain text and creates a new page to display. The related lines in htmlpreview.js of htmlpreview.github.io are:

    var loadJS = function (data) {
    if (data) {
        var script = document.createElement('script');
        script.innerHTML = data;
        document.body.appendChild(script);
    }
};

Is there such a limitation in htmlpreview.github.io or do I have a bad js file architecture?

0 Answers
Related