Skip to content

Instantly share code, notes, and snippets.

@lorisleiva
Last active March 14, 2024 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorisleiva/203887c8681f55c13eecfb3640b90b4d to your computer and use it in GitHub Desktop.
Save lorisleiva/203887c8681f55c13eecfb3640b90b4d to your computer and use it in GitHub Desktop.
Test .patch extension on gists.
From f54a9349cb1205bf34d04d2900cf5e1e69228480 Mon Sep 17 00:00:00 2001
From: Loris Leiva <loris.leiva@gmail.com>
Date: Thu, 14 Mar 2024 15:13:08 +0000
Subject: [PATCH] Fix exported extensions in package.json
---
clients/js/package.json | 8 ++++----
clients/js/tsup.config.ts | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/clients/js/package.json b/clients/js/package.json
index 094c211..4326a11 100644
--- a/clients/js/package.json
+++ b/clients/js/package.json
@@ -3,15 +3,15 @@
"version": "0.1.1",
"description": "The Solana Address Lookup Table program and its clients",
"sideEffects": false,
- "module": "./dist/src/index.mjs",
- "main": "./dist/src/index.js",
+ "module": "./dist/src/index.js",
+ "main": "./dist/src/index.cjs",
"types": "./dist/types/src/index.d.ts",
"type": "module",
"exports": {
".": {
"types": "./dist/types/src/index.d.ts",
- "import": "./dist/src/index.mjs",
- "require": "./dist/src/index.js"
+ "import": "./dist/src/index.js",
+ "require": "./dist/src/index.cjs"
}
},
"files": [
diff --git a/clients/js/tsup.config.ts b/clients/js/tsup.config.ts
index ff05d86..d9d2745 100644
--- a/clients/js/tsup.config.ts
+++ b/clients/js/tsup.config.ts
@@ -7,6 +7,7 @@ const SHARED_OPTIONS: Options = {
entry: ['./src/index.ts'],
inject: [path.resolve(__dirname, 'env-shim.ts')],
outDir: './dist/src',
+ outExtension: ({ format }) => ({ js: format === 'cjs' ? '.cjs' : '.js' }),
sourcemap: true,
treeshake: true,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment