Skip to content

Commit

Permalink
chore(build): create bundler-free ESM distribution and add browser en…
Browse files Browse the repository at this point in the history
…try point (#468)
  • Loading branch information
theashraf authored Feb 7, 2025
1 parent 84f313d commit 1c925ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-students-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/dotlottie-react': minor
---

chore(build): create bundler-free ESM distribution
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.js",
"browser": "dist/browser/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
Expand Down
16 changes: 14 additions & 2 deletions packages/react/tsup.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { defineConfig } = require('tsup');

module.exports = defineConfig({
const config = {
bundle: true,
metafile: false,
splitting: false,
Expand All @@ -15,4 +15,16 @@ module.exports = defineConfig({
target: ['es2020'],
tsconfig: 'tsconfig.build.json',
external: ['react'],
});
};

module.exports = defineConfig([
config,
// CDN build: Self-contained
{
...config,
dts: false,
format: ['esm'],
noExternal: Object.keys(require('./package.json').dependencies),
outDir: 'dist/browser',
},
]);

0 comments on commit 1c925ce

Please sign in to comment.