Skip to content

Commit

Permalink
2023-09-18T12:08:39.468Z
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Sep 18, 2023
1 parent 465bda4 commit f2613a2
Show file tree
Hide file tree
Showing 67 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/082-cjs-vs-esm/212-why-module-nodenext.explainer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "117-const-enums.explainer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon --exec \"tsc && node dist/index.js\" ./src/index.ts"
},
"keywords": [],
"author": "Matt Pocock",
"devDependencies": {}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const example = 123;

export = example;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const hello = () => {
console.log("Hello!");
};

export default hello;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import example = require("./cjs-module.cjs");

const main = async () => {
const esModule = await import("./esm-module.mjs"); // Dynamic import

esModule.default();
};

main();
14 changes: 14 additions & 0 deletions src/082-cjs-vs-esm/212-why-module-nodenext.explainer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES2022",
// Try changing module to commonjs/ESNext and moduleResolution to Bundler
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"verbatimModuleSyntax": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true
},
}

0 comments on commit f2613a2

Please sign in to comment.