1
Fork 0
solar-conflux/typescript/loopover/rollup.config.ts
Matei Adriel 91e8f869aa
typescript(loopover): chore: initial rollup setup
Signed-off-by: prescientmoon <git@moonythm.dev>
2019-11-25 09:33:33 +02:00

55 lines
1.5 KiB
TypeScript

import commonjs from 'rollup-plugin-commonjs'
import nodeResolve from 'rollup-plugin-node-resolve'
import dts from 'rollup-plugin-dts'
import typescript from 'rollup-plugin-typescript2'
import { terser } from 'rollup-plugin-terser'
import { resolve } from 'path'
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}/bundle.cjs.js`,
format: 'cjs',
sourcemap: true
},
{
file: `${outputDirectory}/bundle.esm.js`,
format: 'esm',
sourcemap: true
},
{
file: `${outputDirectory}/bundle.amd.js`,
sourcemap: true,
format: 'amd',
name: 'Ecs'
}
],
plugins: [
nodeResolve({
extensions: ['.ts']
}),
commonjs(),
typescript({
tsconfig: resolve(__dirname, 'tsconfig.json')
}),
!dev && terser()
]
},
{
input: inputFile,
output: [{ file: `${outputDirectory}/index.d.ts`, format: 'es' }],
plugins: [dts()]
}
]