Skip to content

Commit

Permalink
chore: added iife bundling to rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Mar 19, 2024
1 parent 2ab4ba1 commit 202fc2e
Show file tree
Hide file tree
Showing 3 changed files with 302 additions and 9 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"main": "lib/keycert.js",
"module": "lib/keycert.m.js",
"types": "lib/keycert.d.ts",
"iife": "lib/keycert.iife.js",
"browser": {
"buffer": false,
"crypto": false
Expand All @@ -27,6 +28,9 @@
"tslib": "^2.1.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^8.1.1",
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.13",
Expand All @@ -40,8 +44,9 @@
"mocha": "^9.0.3",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"rollup": "^2.38.2",
"rollup": "^2.78.0",
"rollup-plugin-dts": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"ts-node": "^10.2.0",
"typedoc": "^0.22.4",
"typescript": "^4.1.2"
Expand Down
24 changes: 24 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import fs from 'fs'
import dts from 'rollup-plugin-dts'
import typescript from '@rollup/plugin-typescript'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';

import pkg from './package.json'

Expand Down Expand Up @@ -43,6 +47,26 @@ export default [
external,
onwarn,
},
{
input: 'src/index.ts',
output: {
banner,
name: 'KeycertJs',
file: pkg.iife,
format: 'iife',
globals: {},
sourcemap: true,
},
plugins: [
json(),
typescript({ tsconfig: './tsconfig.json' }),
resolve(),
commonjs(),
terser(),
],
external: [], // All dependencies are bundled
onwarn,
},
{
input: 'src/index.ts',
output: {banner, file: pkg.types, format: 'esm'},
Expand Down
Loading

0 comments on commit 202fc2e

Please sign in to comment.