1
0
Fork 0
docsearch/packages/docsearch-js/rollup.config.js
Vasco Bettencourt 5381e76126
fix(docsearch-js): resultsFooterComponent not working in JS CDN version (#2786)
* fix: resultsFooterComponent not working in JS CDN version

* fix: ci

* feat: implement htm templates

* fix: ci

* fix

* fix

* fix: ci

* fix: types

* fix: rollup

* fix: ci

* fix

* feat: add hitComponent updated docs

* fix: formatting
2025-10-15 09:57:00 +01:00

72 lines
1.5 KiB
JavaScript

// rollup.config.js
import replace from '@rollup/plugin-replace';
import { dts } from 'rollup-plugin-dts';
import { plugins } from '../../rollup.base.config.js';
import { getBundleBanner } from '../../scripts/getBundleBanner.js';
import pkg from './package.json' with { type: 'json' };
const externalsForTypes = [
/^preact(\/|$)/,
/^preact\/jsx-runtime$/,
/^react(\/|$)/,
/^react-dom(\/|$)/,
/^@types\/react(\/|$)/,
/^@ai-sdk\/react(\/|$)/,
];
export default [
// ESM JS
{
input: 'src/index.ts',
output: [
{
file: 'dist/esm/index.js',
format: 'es',
sourcemap: true,
banner: getBundleBanner(pkg),
},
],
plugins: [
...plugins,
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
],
},
// UMD JS
{
input: 'src/index.ts',
output: [
{
file: 'dist/umd/index.js',
format: 'umd',
sourcemap: true,
name: 'docsearch',
banner: getBundleBanner(pkg),
},
],
plugins: [
...plugins,
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
],
},
// Types bundle
{
input: 'dist/esm/types/index.d.ts',
output: [{ file: 'dist/esm/index.d.ts', format: 'es' }],
external: (id) => externalsForTypes.some((rx) => rx.test(id)),
plugins: [
dts({
respectExternal: true,
}),
],
},
];