Skip to content

Commit

Permalink
fix(build): use exports map (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
lednhatkhanh authored Aug 7, 2023
1 parent 6f740c7 commit fdc825d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"name": "@minswap/sdk",
"version": "0.2.0-beta",
"description": "Query Minswap data and build transactions",
"main": "./build/index.js",
"module": "./build/index.es.js",
"types": "./build/index.d.ts",
"type": "module",
"exports": {
".": {
"types": "./build/index.d.ts",
"import": "./build/index.es.js"
}
},
"files": [
"build"
],
Expand Down
11 changes: 2 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import dts from "rollup-plugin-dts";
import esbuild from "rollup-plugin-esbuild";

const name = require("./package.json").main.replace(/\.js$/, "");

const bundle = (config) => ({
...config,
input: "src/index.ts",
Expand All @@ -14,12 +12,7 @@ export default [
plugins: [esbuild()],
output: [
{
file: `${name}.js`,
format: "cjs",
sourcemap: true,
},
{
file: `${name}.es.js`,
file: `build/index.es.js`,
format: "es",
sourcemap: true,
},
Expand All @@ -28,7 +21,7 @@ export default [
bundle({
plugins: [dts()],
output: {
file: `${name}.d.ts`,
file: `build/index.d.ts`,
format: "es",
},
}),
Expand Down

0 comments on commit fdc825d

Please sign in to comment.