Skip to content

Commit

Permalink
2023-09-18T11:43:41.063Z
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Sep 18, 2023
1 parent a2a192b commit 4f012b7
Show file tree
Hide file tree
Showing 210 changed files with 185 additions and 10 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "exercise",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"dev": "tsc --watch"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"esModuleInterop": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true
},
}
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 ./src/index.js"
},
"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,7 @@
const esmModule = require("./esm-module.js"); // cjs require

const main = async () => {
esmModule.default();
};

main();
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 ./src/index.js"
},
"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,5 @@
const hello = () => {
console.log("Hello!");
};

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

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

esmModule.default();
};

main();
5 changes: 5 additions & 0 deletions src/082-cjs-vs-esm/207-mts-files.problem/src/esm-module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const hello = () => {
console.log("Hello!");
};

export default hello;
7 changes: 7 additions & 0 deletions src/082-cjs-vs-esm/207-mts-files.problem/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const main = async () => {
const esmModule = await import("./esm-module.js"); // Dynamic import

esmModule.default();
};

main();
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"noEmit": false,
"outDir": "dist",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true
Expand Down
12 changes: 12 additions & 0 deletions src/082-cjs-vs-esm/207-mts-files.solution/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": {}
}
5 changes: 5 additions & 0 deletions src/082-cjs-vs-esm/207-mts-files.solution/src/esm-module.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const hello = () => {
console.log("Hello!");
};

export default hello;
7 changes: 7 additions & 0 deletions src/082-cjs-vs-esm/207-mts-files.solution/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const main = async () => {
const esmModule = await import("./esm-module.mjs"); // Dynamic import

esmModule.default();
};

main();
12 changes: 12 additions & 0 deletions src/082-cjs-vs-esm/207-mts-files.solution/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true
},
}
12 changes: 12 additions & 0 deletions src/082-cjs-vs-esm/208-verbatim-module-syntax.problem/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": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const hello = () => {
console.log("Hello!");
};

// @ts-expect-error
export default hello;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true
},
}
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": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const hello = () => {
console.log("Hello!");
};

// @ts-expect-error
export default hello;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"verbatimModuleSyntax": true
},
}
Empty file.

0 comments on commit 4f012b7

Please sign in to comment.