packages/widget/rollup.config.js
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import dts from 'rollup-plugin-dts'
import postcss from 'rollup-plugin-postcss'
import json from '@rollup/plugin-json'
import terser from '@rollup/plugin-terser'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import sourcemaps from 'rollup-plugin-sourcemaps'
import { codecovRollupPlugin } from "@codecov/rollup-plugin";
import packageJson from './package.json' assert { type: 'json' }
export default [
{
input: 'src/index.tsx',
output: [
{
file: packageJson.main,
sourcemap: true,
format: 'cjs',
},
{
file: packageJson.module,
sourcemap: true,
format: 'esm',
},
],
external: [
'react',
'react/jsx-runtime',
'ethers',
'react-redux',
'@reduxjs/toolkit',
'@synapsecns/sdk-router',
'@ethersproject/providers',
'@ethersproject/units',
'lodash',
],
plugins: [
peerDepsExternal(),
resolve(),
commonjs(),
typescript({
tsconfig: './tsconfig.json',
declaration: true,
declarationDir: 'dist',
}),
postcss({
plugins: [],
}),
json(),
terser(),
sourcemaps(),
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: "widget",
uploadToken: process.env.CODECOV_TOKEN,
uploadOverrides: {
sha: process.env.GH_COMMIT_SHA,
}
}),
],
watch: {
buildDelay: 200,
},
},
{
input: 'src/types/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
plugins: [dts.default()],
external: [/\.(css|less|scss)$/],
},
]