Last active
May 23, 2023 09:53
-
-
Save xgqfrms/7abacf4807cd00f046bc53fb6d9a4118 to your computer and use it in GitHub Desktop.
ESM export modules demos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import { autoReport, manualReport, } from "./index.js"; | |
import Metrics, { autoReport, manualReport, } from "./index.js"; | |
if(autoReport && manualReport) { | |
console.log(`app ✅`); | |
autoReport(); | |
manualReport(); | |
console.log(`Metrics ✅`); | |
Metrics.autoReport(); | |
Metrics.manualReport(); | |
} else { | |
console.log(`app ❌`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-Hans"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<meta name="author" content="xgqfrms"> | |
<meta name="generator" content="VS code"> | |
<title>ESM export modules demos</title> | |
</head> | |
<body> | |
<header> | |
<h1>ESM export modules demos</h1> | |
</header> | |
<main> | |
<section> | |
<a href="https://feiqa.xgqfrms.xyz/index.html"></a> | |
</section> | |
<article></article> | |
</main> | |
<footer> | |
<p>copyright© xgqfrms 2022</p> | |
</footer> | |
<script src="./app.js" type="module"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const autoReport = () => console.log(`autoReport`); | |
const manualReport = () => console.log(`manualReport`); | |
const Metrics = { | |
autoReport, | |
manualReport, | |
}; | |
export { | |
autoReport, | |
manualReport, | |
}; | |
// export default Metrics; | |
export default { | |
...Metrics | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test ok ✅