GitHub.js does not provide an export named 'default'
Solution 1
The solution was to remove the include and add the .js file and its depencies on the html file. Note that it's not really clear if you read github.js' site.
<html>
<body id="mybody">
<button id="mybutton" >Click me</button>
<script src="GitHub.bundle.min.js"></script>
<script src="underscore-min.js"></script>
<script type="module" src="popup.js"></script>
</body>
</html>
Solution 2
There might be a trick to do so:
Try :
import * as GitHub from '/static/GitHub.bundle.js';
maugch
Updated on June 04, 2022Comments
-
maugch almost 2 years
I am trying to use GitHub.js on a Chrome/Firefox extension and I have some issues.
Uncaught SyntaxError: The requested module '/static/GitHub.bundle.js' does not provide an export named 'default'
I've found a possible solution here but I still doesn't work. The authors of 99% of javascript give for granted that the basics are know, but either I don't know them or there is a subtle issue/bug I don't see.
My code is simple:
<html> <body id="mybody"> <button id="mybutton" >Click me</button> <script type="module" src="popup.js"></script> </body> </html>
and popup.js:
//import GitHub from './GitHub.bundle.js'; import * as GitHub from './GitHub.bundle.js'; function onWindowLoad() { } window.onload = onWindowLoad; document.getElementById("mybutton").addEventListener("click", clickme); function clickme() { var github = new GitHub({ username: 'USER', password: 'PASS', auth: 'basic' }); }
it does stop immediately. it doesn't matter what I have after that. What am I doing wrong? It shouldn't work even as a standalone page.
Note that I have to use .js or I get a "file not found".