Javascript modules with @babel/standalone

Viewed 91

I am trying to use Javascript import with @babel/standalone, and I am getting this error:

Uncaught ReferenceError: require is not defined

This is my minimal reproducible code:

<!DOCTYPE html>
<html>
    <head>
        <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
        <script type="text/babel" data-type="module">
            import a from './abc.js';
            console.log(a);
        </script>
    </head>
    <body>
    </body>
</html>

And abc.js file:

export default 567;

What am I doing wrong?

0 Answers
Related