Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 497 Bytes

es6-module-import-in-client-browsers.md

File metadata and controls

28 lines (18 loc) · 497 Bytes
  • Date : 2023-08-29
  • Tags : js es6

ES6 Module import in client browsers

moduleA.js

export const message = "Hello from moduleA!";

moduleB.js

import { message } from './moduleA.js';
console.log(message);

app.html

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

// Print console log "Hello from moduleA!"

So moduleB.js acts like a module entry-point, it loads all dependencies deeply to run it-self, so you only need add script tag point to it.