Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.07 KB

NOTES.md

File metadata and controls

52 lines (34 loc) · 1.07 KB

Notes to self

ESM migration

settings

file - setting commonjs esm
package.json - type commonjs module
tsconfig.json - module commonjs es2020
tsconfig.json - esModuleInterop true not required?

exporting modules

src/index.ts

commonjs

import { default as Bir } from './bir'
export = Bir

esm

import Bir from "./bir.js";
export default Bir;

__dirname

definie __dirname missing in esm

import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

API documentation

consider to use