Using ES6 Module In Browser.
Now in browser, to use comman js module style:
1. i1.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script type="module">
import x from "./i1.js";
console.log(x.a);
</script>
</body>
</html>
2. i1.js in same level folder
export default { a: "2" };
This makes js module imprting exports from a single file as a module via common js style possible.
浙公网安备 33010602011771号