bdcontract-sdk-javascript/rollup.config.ts
2023-03-18 19:55:44 +08:00

65 lines
1.5 KiB
TypeScript

import type { RollupOptions } from '@rollup'
import commonjs from '@rollup/plugin-commonjs'
import dts from 'rollup-plugin-dts'
import { terser } from 'rollup-plugin-terser'
import typescript from 'rollup-plugin-typescript2'
const pkg = require('./package.json')
const name = 'bdcontract'
export default [
{
input: 'node_modules/@lifeomic/axios-fetch/src/index.js',
output: {
file: 'dist/axios-fetch.iife.js',
format: 'iife',
name: 'axiosFetch',
},
plugins: [commonjs()],
},
{
input: 'src/index.ts',
output: [
{
file: `${pkg.main}`,
format: 'umd',
name,
sourcemap: true,
globals: {
'@daotl/cryptico': 'cryptico',
'@lifeomic/axios-fetch': 'axiosFetch',
axios: 'axios',
'sm-crypto': 'smCrypto',
},
},
{ file: `${pkg.module}`, format: 'es', sourcemap: true },
{
file: `${pkg.iife}`,
format: 'iife',
name,
sourcemap: true,
globals: {
'@daotl/cryptico': 'cryptico',
'@lifeomic/axios-fetch': 'axiosFetch',
axios: 'axios',
'sm-crypto': 'smCrypto',
},
},
],
plugins: [
typescript({
tsconfig: 'tsconfig.build.json',
useTsconfigDeclarationDir: true,
}),
terser(),
commonjs(),
],
},
{
input: 'types/index.d.ts',
output: [{ file: 'lib/index.d.ts' }],
plugins: [dts()],
},
] as RollupOptions