-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit uses rollup, same as solana's web3 project uses to bundle a browser-specific build
- Loading branch information
Showing
4 changed files
with
246 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.rollup.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import nodeResolve from "@rollup/plugin-node-resolve"; | ||
import typescript from "@rollup/plugin-typescript"; | ||
import replace from "@rollup/plugin-replace"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import { terser } from "rollup-plugin-terser"; | ||
|
||
const env = process.env.NODE_ENV; | ||
|
||
export default { | ||
input: "src/index.ts", | ||
plugins: [ | ||
commonjs(), | ||
nodeResolve({ | ||
browser: true, | ||
extensions: [".js", ".ts"], | ||
dedupe: ["bn.js", "buffer"], | ||
preferBuiltins: false, | ||
}), | ||
typescript({ | ||
tsconfig: "./tsconfig.base.json", | ||
moduleResolution: "node", | ||
outDir: "types", | ||
target: "es2019", | ||
outputToFilesystem: false, | ||
}), | ||
replace({ | ||
preventAssignment: true, | ||
values: { | ||
"process.env.NODE_ENV": JSON.stringify(env), | ||
"process.env.BROWSER": JSON.stringify(true), | ||
}, | ||
}), | ||
terser(), | ||
], | ||
external: [ | ||
"@project-serum/borsh", | ||
"@solana/web3.js", | ||
"assert", | ||
"base64-js", | ||
"bn.js", | ||
"bs58", | ||
"buffer", | ||
"camelcase", | ||
"eventemitter3", | ||
"js-sha256", | ||
"pako", | ||
"toml", | ||
], | ||
output: { | ||
file: "dist/browser/index.js", | ||
format: "cjs", | ||
sourcemap: true, | ||
}, | ||
}; |
Oops, something went wrong.