1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27import typescript from 'rollup-plugin-typescript2' import pkg from './package.json' console.log(pkg) let external = [ ...Object.keys(pkg.dependencies || {}), ]; console.log(external) export default { input: 'src/index.tsx', output: [ { file: pkg.main, format: 'cjs', }, { file: pkg.module, format: 'es', }, ], external: external, plugins: [ typescript({ typescript: require('typescript'), }), ], }