Skip to content

Commit

Permalink
Attempt to fix ESM (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
samchungy authored Feb 19, 2024
1 parent cc29621 commit 16baec0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
11 changes: 11 additions & 0 deletions esbuild.esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { build } from 'esbuild';

await build({
entryPoints: ['src/index.ts'],
bundle: true,
platform: 'node',
format: 'esm',
target: ['es2022'],
outdir: './lib-esm',
outExtension: { '.js': '.mjs' },
});
10 changes: 10 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { build } from 'esbuild';

await build({
entryPoints: ['src/index.ts'],
bundle: true,
platform: 'node',
format: 'cjs',
target: ['es2022'],
outdir: './lib-commonjs',
});
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,23 @@
},
"license": "MIT",
"sideEffects": false,
"exports": {
".": {
"import": "./lib-esm/index.mjs",
"require": "./lib-commonjs/index.js",
"types": "./lib-types/index.d.ts"
}
},
"main": "./lib-commonjs/index.js",
"module": "./lib-es2015/index.js",
"module": "./lib-esm/index.mjs",
"types": "./lib-types/index.d.ts",
"files": [
"lib*/**/*.d.ts",
"lib*/**/*.js",
"lib*/**/*.js.map",
"lib*/**/*.{js,mjs}{,.map}",
"lib*/**/*.json"
],
"scripts": {
"build": "skuba build-package",
"build": "node esbuild.mjs && node esbuild.esm.mjs && tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json",
"format": "skuba format",
"lint": "skuba lint",
"prepare": "pnpm build",
Expand Down

0 comments on commit 16baec0

Please sign in to comment.