Skip to content

Commit

Permalink
v1.0, no treshakigng in react
Browse files Browse the repository at this point in the history
  • Loading branch information
PuruVJ committed Sep 23, 2024
1 parent 1ace95f commit e0e8a6b
Show file tree
Hide file tree
Showing 5 changed files with 2,727 additions and 2,159 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-cups-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neoconfetti/react': major
---

Compatible with React Server Components
13 changes: 9 additions & 4 deletions packages/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import { Plugin } from 'esbuild';
import { transform } from 'lightningcss';
import fs from 'node:fs';
import { resolve } from 'node:path';
import { defineConfig } from 'tsup';
import { defineConfig, type Options } from 'tsup';

export const coreConfig = ({ dtsBanner }: { dtsBanner?: string } = { dtsBanner: '' }) =>
export const coreConfig = ({
jsBanner = '',
dtsBanner = '',
treeshake = 'smallest',
}: { jsBanner?: string; dtsBanner?: string; treeshake?: Options['treeshake'] } = {}) =>
defineConfig([
{
entry: ['./src/index.ts'],
Expand All @@ -14,8 +18,9 @@ export const coreConfig = ({ dtsBanner }: { dtsBanner?: string } = { dtsBanner:
target: 'es2022',
dts: { resolve: true, banner: dtsBanner },
clean: true,
treeshake: 'smallest',
treeshake,
esbuildPlugins: [processCSS()],
banner: { js: jsBanner },
},
{
entry: ['./src/index.ts'],
Expand All @@ -25,7 +30,7 @@ export const coreConfig = ({ dtsBanner }: { dtsBanner?: string } = { dtsBanner:
target: 'es2022',
clean: true,
outDir: 'dist/min',
treeshake: 'smallest',
treeshake,
esbuildPlugins: [processCSS()],
},
]);
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import { confetti, type ConfettiOptions, type ConfettiParticleShape } from '@neoconfetti/core';
import { createElement, useEffect, useRef } from 'react';

Expand Down
5 changes: 4 additions & 1 deletion packages/react/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { coreConfig } from '../config';

export default coreConfig({});
export default coreConfig({
jsBanner: '"use client";',
treeshake: false,
});
Loading

0 comments on commit e0e8a6b

Please sign in to comment.