Skip to content

Commit

Permalink
build: update build config
Browse files Browse the repository at this point in the history
  • Loading branch information
nhanluongoe committed Jan 2, 2024
1 parent 3bdfdee commit 89ba5da
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import { defineConfig } from 'tsup';
/* eslint-disable no-param-reassign */
import { Options, defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts'],
treeshake: true,
sourcemap: 'inline',
const commonConfig: Options = {
minify: true,
clean: true,
dts: true,
splitting: false,
format: ['cjs', 'esm'],
external: ['react'],
injectStyle: false,
});
format: ['esm', 'cjs'],
sourcemap: true,
clean: true,
};
export default defineConfig([
{
...commonConfig,
esbuildOptions: (options) => {
// Append "use client" to the top of the react entry point
options.banner = {
js: '"use client";',
};
},
entry: ['src/index.ts'],
outDir: 'dist',
},
]);

0 comments on commit 89ba5da

Please sign in to comment.