From e5023ba050cb35fa8b17fd3da6d8e59ff53af47c Mon Sep 17 00:00:00 2001 From: Francisco Javier Ribo Labrador Date: Thu, 31 Oct 2024 21:38:34 +0100 Subject: [PATCH] fix: simplify the build by only building cjs version which is required at the moment, it can still be used on both --- esbuild.config.mjs | 20 ++++++-------------- index.cjs | 2 +- index.mjs | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) 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