Skip to content

Commit

Permalink
fix: simplify the build by only building cjs version which is require…
Browse files Browse the repository at this point in the history
…d at the moment, it can still be used on both
  • Loading branch information
elribonazo committed Oct 31, 2024
1 parent fbd5358 commit e5023ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
20 changes: 6 additions & 14 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,22 @@ const generic = {
platform: 'neutral',
splitting: false,
resolveExtensions: ['.ts', '.js', '.wasm'],
inject: ['anoncreds-wasm', 'didcomm-wasm', 'jwe-wasm'],
mainFields: ['module', 'main'],
banner: {
js: bufferShim,
},
target: ['esnext'],
define: {
'global.Buffer': 'Buffer',
},
banner: {
js: bufferShim,
},
external: ['buffer']
};

(async () => {
await esbuild.build({
...generic,
outfile: "build/index.mjs",
target: ['esnext'],
format: 'esm',
plugins
})
await esbuild.build({
...generic,
entryPoints: ['./build/index.mjs'],
outfile: "build/index.cjs",
target: ['es6'],
outdir: "build",
inject: ['anoncreds-wasm', 'didcomm-wasm', 'jwe-wasm'],
format: 'cjs',
plugins
})
Expand Down
2 changes: 1 addition & 1 deletion index.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./build/index.cjs')
module.exports = require('./build/index.js')
2 changes: 1 addition & 1 deletion index.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import * as SDK from './build/index.mjs';
import SDK from './build/index.js';

export default SDK

0 comments on commit e5023ba

Please sign in to comment.