Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dual module export #607

Merged
merged 10 commits into from
Oct 18, 2023
Prev Previous commit
Next Next commit
feat: distinct cjs and esm tsconfig
  • Loading branch information
antstanley committed Oct 18, 2023
commit a1f146ab6e3afed1ebbc7cb148fa86baba7397ae
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test-types": "tsd",
"check-types": "tsc --noEmit",
"lint": "eslint .",
"build:cjs": "tsc -p tsconfig.build.json && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json",
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json",
"build:esm": "tsc -p tsconfig.esm.json && echo '{ \"type\": \"module\" }' > dist/esm/package.json",
"build": "npm run build:cjs & npm run build:esm",
"prebuild": "rm -rf dist",
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.build.json → tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"moduleResolution": "node",
"module": "commonjs",
"outDir": "dist/cjs"
},
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test-d.ts"]
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"baseUrl": "src",
"target": "es2019",
"rootDir": "src",
"moduleResolution": "node",
"module": "commonjs",
"declaration": true,
"inlineSourceMap": false,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
Expand Down