Skip to content

Commit fc3e222

Browse files
committed
ES modules example
1 parent d09e353 commit fc3e222

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

JavaScript/8-export.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Entity {}
2+
3+
const fn = x => x;
4+
5+
const collection = new Map();
6+
7+
// module.exports = { Entity, fn, collection };
8+
export { Entity, fn, collection };

JavaScript/9-import.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Entity, fn, collection } from './8-export.mjs';
2+
import m1 from './1-export.js';
3+
4+
console.log({ Entity, fn, collection });
5+
console.log(m1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy