1
Fork 0
solar-conflux/typescript/option/rollup.config.ts
Matei Adriel 6f93885507
typescript(option): chore: fixed build process
Signed-off-by: prescientmoon <git@moonythm.dev>
2019-12-22 17:38:10 +02:00

52 lines
1.3 KiB
TypeScript

import { terser } from 'rollup-plugin-terser'
import { resolve } from 'path'
import ts from '@wessberg/rollup-plugin-ts'
const outputDirectory = resolve(__dirname, 'dist')
const inputFile = resolve(__dirname, 'src/index.ts')
const npmConfig = require(resolve(__dirname, `package.json`))
const external = Object.keys(npmConfig.dependencies || {})
const dev = Boolean(process.env.ROLLUP_WATCH)
export default [
{
input: inputFile,
external,
output: [
{
file: `${outputDirectory}/index.cjs.js`,
format: 'cjs',
sourcemap: true
},
{
file: `${outputDirectory}/index.amd.js`,
sourcemap: true,
format: 'amd',
name: 'Option'
}
],
plugins: [ts(), !dev && terser()]
},
{
input: inputFile,
external,
output: [
{
file: `${outputDirectory}/index.esm.js`,
format: 'esm',
sourcemap: true
}
],
plugins: [
ts({
tsconfig: {
declaration: true
}
}),
!dev && terser()
]
}
]