diff --git a/esbuild.config.mjs b/esbuild.config.mjs index e6be9e9c1..96e326565 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -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 }) diff --git a/index.cjs b/index.cjs index 15f1d2bdf..4d26afbfd 100644 --- a/index.cjs +++ b/index.cjs @@ -1 +1 @@ -module.exports = require('./build/index.cjs') +module.exports = require('./build/index.js') diff --git a/index.mjs b/index.mjs index 1ca200451..55f562ada 100644 --- a/index.mjs +++ b/index.mjs @@ -1,3 +1,3 @@ -import * as SDK from './build/index.mjs'; +import SDK from './build/index.js'; export default SDK \ No newline at end of file