From a43f2a708ccddf98cd1ea7a6a79053828f0b2415 Mon Sep 17 00:00:00 2001 From: jiftechnify Date: Sat, 23 Dec 2023 17:38:49 +0900 Subject: [PATCH] fix problem when required from CommonJS --- build.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build.js b/build.js index b46642d..863c3c2 100755 --- a/build.js +++ b/build.js @@ -28,12 +28,7 @@ esbuild format: 'esm', packages: 'external', }) - .then(() => { - const packageJson = JSON.stringify({ type: 'module' }) - fs.writeFileSync(`${__dirname}/lib/esm/package.json`, packageJson, 'utf8') - - console.log('esm build success.') - }) + .then(() => console.log('esm build success.')) esbuild .build({ @@ -42,7 +37,12 @@ esbuild format: 'cjs', packages: 'external', }) - .then(() => console.log('cjs build success.')) + .then(() => { + const packageJson = JSON.stringify({ type: 'commonjs' }) + fs.writeFileSync(`${__dirname}/lib/cjs/package.json`, packageJson, 'utf8') + + console.log('cjs build success.') + }) esbuild .build({