tiptap/shared/rollup-config/index.js
bdbch 44e4eca47a
Shared rollup config (#5403)
* add one shared rollup config

* rename to baseConfig
2024-07-27 12:46:39 +02:00

63 lines
1.3 KiB
JavaScript

import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import autoExternal from 'rollup-plugin-auto-external'
import sourcemaps from 'rollup-plugin-sourcemaps'
import typescript from 'rollup-plugin-typescript2'
export const baseConfig = ({
input = 'src/index.ts',
pkg,
}) => ({
external: [/@tiptap\/pm\/.*/],
input,
output: [
{
name: pkg.name,
file: pkg.umd,
format: 'umd',
sourcemap: true,
exports: 'named',
},
{
name: pkg.name,
file: pkg.main,
format: 'cjs',
interop: 'compat',
sourcemap: true,
exports: 'named',
},
{
name: pkg.name,
file: pkg.module,
format: 'es',
sourcemap: true,
exports: 'named',
},
],
plugins: [
autoExternal({
packagePath: './package.json',
}),
sourcemaps(),
resolve(),
commonjs(),
babel({
babelHelpers: 'bundled',
exclude: '../../node_modules/**',
}),
typescript({
tsconfig: '../../tsconfig.json',
tsconfigOverride: {
compilerOptions: {
declaration: true,
paths: {
'@tiptap/*': ['packages/*/src'],
},
},
include: null,
},
}),
],
})