Skip to content

Commit

Permalink
fix: adjust exports in package.json, fix umd build
Browse files Browse the repository at this point in the history
  • Loading branch information
paolostyle committed Jan 20, 2025
1 parent 06b7145 commit e8b771c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@
"homepage": "https://github.com/Hacker0x01/react-datepicker",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"browser": "dist/react-datepicker.min.js",
"module": "dist/es/index.js",
"unpkg": "dist/react-datepicker.min.js",
"style": "dist/react-datepicker.min.css",
"exports": {
".": {
"import": "./dist/es/index.js",
"require": "./dist/index.js",
"types": "./dist/index.d.ts",
"default": "./dist/es/index.js"
}
},
"files": ["*.md", "dist", "lib", "es", "src/stylesheets"],
"sideEffects": ["**/*.css"],
"keywords": ["react", "datepicker", "calendar", "date", "react-component"],
Expand Down
9 changes: 6 additions & 3 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ const banner = `/*!

const globals = {
react: "React",
"prop-types": "PropTypes",
"react-dom": "ReactDOM",
clsx: "clsx",
"date-fns": "dateFns",
"@floating-ui/react": "FloatingUIReact",
};

// NOTE:https://rollupjs.org/migration/#changed-defaults
Expand All @@ -40,7 +43,7 @@ const config = {
input: "src/index.tsx",
output: [
{
file: pkg.browser,
file: pkg.unpkg,
format: "umd",
name: "DatePicker",
globals,
Expand All @@ -49,7 +52,7 @@ const config = {
plugins: [terser()],
},
{
file: pkg.browser.replace(".min.js", ".js"),
file: pkg.unpkg.replace(".min.js", ".js"),
format: "umd",
sourcemap: "inline",
name: "DatePicker",
Expand Down

0 comments on commit e8b771c

Please sign in to comment.