Skip to content

upupming/esm-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esm test

Just a test for es modules behavior in browser:

index.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="b.js" type="module"></script>
    <script type="module">
      import { c } from './c.js';
      c();
    </script>
  </body>
</html>

a.js:

export const a = () => alert('a')

b.js:

import { a } from './a.js'

a()

c.js:

export const c = () => alert('c')

You will see alert(a) and alert(c) in order in your browser.

Ref

  1. https://stackoverflow.com/questions/43817297/inlining-ecmascript-modules-in-html

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors