0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/elements/tsup.config.ts
2024-07-22 11:36:44 +08:00

23 lines
562 B
TypeScript

import fs from 'node:fs/promises';
import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/index.ts', 'src/react.ts'],
format: 'esm',
dts: true,
clean: true,
esbuildPlugins: [
{
name: 'transform-svg',
setup: (build) => {
build.onLoad({ filter: /\.svg$/ }, async (arguments_) => {
const text = await fs.readFile(arguments_.path, 'utf8');
return {
contents: `import { html } from 'lit';\nexport default html\`${text}\`;`,
};
});
},
},
],
});