Skip to content

Commit

Permalink
chore!: convert to ESM
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the library is now ESM-only
BREAKING CHANGE: CJS build is no longer bundled
  • Loading branch information
igordanchenko committed Jun 21, 2024
1 parent 5f165c7 commit 1ea484e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 26 deletions.
File renamed without changes.
16 changes: 5 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
"description": "Responsive photo gallery component for React",
"author": "Igor Danchenko",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.mjs",
"type": "module",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"files": [
"dist"
Expand Down Expand Up @@ -46,7 +40,7 @@
"start": "npm-run-all clean --parallel \"build:* -- -w\"",
"lint": "eslint .",
"test": "vitest run --coverage",
"dev": "vite --config dev/vite.config.mts"
"dev": "vite --config dev/vite.config.ts"
},
"peerDependencies": {
"react": ">=18"
Expand Down
7 changes: 7 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import dts from "rollup-plugin-dts";

export default {
input: "src/index.ts",
output: { dir: "dist" },
plugins: [dts()],
};
11 changes: 0 additions & 11 deletions rollup.config.mjs

This file was deleted.

8 changes: 4 additions & 4 deletions vite.config.mts → vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export default defineConfig({
minify: false,
target: "es2020",
lib: {
entry: "src/index.ts",
formats: ["cjs", "es"],
fileName: (format) => `index.${format === "es" ? "mjs" : "js"}`,
entry: {
index: "src/index.ts",
},
formats: ["es"],
},
rollupOptions: {
external: "react",
output: {
exports: "named",
banner: '"use client";',
},
plugins: [cleanup({ extensions: ["ts", "tsx"] })],
Expand Down

0 comments on commit 1ea484e

Please sign in to comment.