Skip to content

Commit

Permalink
[Fix] ESM build changes (#211)
Browse files Browse the repository at this point in the history
* intial code for esm build

* Little adjustment

---------

Co-authored-by: mmjee <root@git.maharshi.ninja>
  • Loading branch information
makylfang and mmjee authored Jan 9, 2024
1 parent e654829 commit f22ee05
Show file tree
Hide file tree
Showing 5 changed files with 397 additions and 42 deletions.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"name": "@arcana/auth",
"version": "1.0.8",
"description": "Arcana Auth",
"main": "dist/standalone/auth.esm.js",
"main": "dist/index.js",
"type": "module",
"module": "dist/standalone/auth.esm.js",
"module": "dist/index.js",
"jsdelivr": "dist/standalone/auth.umd.js",
"unpkg": "dist/standalone/auth.umd.js",
"exports": {
".": {
"types": "./types/index.d.ts",
"require": "./dist/standalone/auth.esm.js",
"import": "./dist/standalone/auth.esm.js"
"require": "./dist/index.js",
"import": "./dist/index.js"
}
},
"types": "types/index.d.ts",
"types": "dist/types/index.d.ts",
"files": [
"dist",
"types"
Expand Down Expand Up @@ -59,7 +59,7 @@
"@rollup/plugin-inject": "^4.0.4",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.3.3",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^27.4.1",
"@types/validator": "^13.11.1",
"@typescript-eslint/eslint-plugin": "^5.18.0",
Expand Down Expand Up @@ -90,6 +90,7 @@
},
"dependencies": {
"@metamask/safe-event-emitter": "^2.0.0",
"@solana/web3.js": "^1.87.3",
"bs58": "^5.0.0",
"eth-rpc-errors": "^4.0.3",
"penpal": "^6.0.1",
Expand Down
13 changes: 11 additions & 2 deletions rollup.es.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ import baseConfig from './rollup.base.config'
export default {
...baseConfig,
output: {
file: 'dist/standalone/auth.esm.js',
format: 'es',
dir: 'dist',
// file: 'dist/standalone/auth.esm.js',
format: 'esm',
compact: true,
chunkFileNames: '[name].chunk.js',
manualChunks: function (id) {
if (id.includes('@solana/web3.js/lib')) {
return 'solana'
} else if (id.includes('/node_modules/')) {
return 'vendor'
}
},
},
}
1 change: 1 addition & 0 deletions rollup.umd.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default {
file: 'dist/standalone/auth.umd.js',
format: 'umd',
name: 'arcana.auth',
inlineDynamicImports: true,
compact: true,
},
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"declarationDir": "types",
"declarationDir": "dist/types",
"outDir": "dist",
"strict": true,
"noImplicitAny": true,
Expand Down
Loading

0 comments on commit f22ee05

Please sign in to comment.