Skip to content

Commit e0a2bb8

Browse files
committed
Implementation of cjm2esm module
1 parent 6611d53 commit e0a2bb8

File tree

2 files changed

+5
-45
lines changed

2 files changed

+5
-45
lines changed

src/modules/cjsToEsm.cjs

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/modules/esm.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ if (random > 0.5) {
1717
} else {
1818
fileName = 'b.json';
1919
}
20-
// Both variants are viable https://discord.com/channels/755676888680366081/1363206860160631114/1365003228994998403
21-
// unknownObject = {default: JSON.parse(fs.readFileSync(path.join(__dirname, 'files', fileName), 'utf-8'))};
22-
unknownObject = await import(`./files/${fileName}`, { with: { type: 'json' } });
20+
21+
unknownObject = fs.readFileSync(path.join(__dirname, 'files', fileName), 'utf-8');
22+
2323
console.log(`Release ${release()}`);
2424
console.log(`Version ${version()}`);
2525
console.log(`Path segment separator is "${path.sep}"`);
@@ -32,8 +32,8 @@ const myServer = createServerHttp((_, res) => {
3232
});
3333

3434
const PORT = 3000;
35-
// Assign to emp object prototype to get rid of [Module prototype null] or something
36-
console.log(Object.assign({}, unknownObject));
35+
36+
console.log(unknownObject);
3737

3838
myServer.listen(PORT, () => {
3939
console.log(`Server is listening on port ${PORT}`);

0 commit comments

Comments
 (0)