for Node.js
node --experimental-default-type=module main.jsfor Browser
npx serve .
open http://localhost:3000{"a":"1_a","b":"1_b","c":"2_c"}{"a":"1_a","b":"1_b","c":"2_c"}{"a":"1_a","b":"1_b","c":"2_c"}{"a":"1_a","b":"1_b","c":"2_c"}| export * from './2.js'; | |
| export * from './3.js'; | |
| export * from './4.js'; | |
| export const a = '1_a'; | |
| export const b = '1_b'; |
| export const b = '2_b'; // This conflicts with 1.js and is hidden | |
| export const c = '2_c'; |
| export const d = '3_d'; // This conflicts with 4.js and is hidden |
| export const d = '4_d'; // This conflicts with 3.js and is hidden |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <script type="module" src="./main.js"></script> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
| import * as exports from './1.js'; | |
| console.log(JSON.stringify(exports)); |