Skip to content

Commit c2a4cab

Browse files
authored
chore: fix ssr and build for esm and cjs (#59)
1 parent 8093649 commit c2a4cab

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ coverage
66
.nyc_output
77
yarn-error.log
88
dist
9-
test/__snapshots__
9+
test/__snapshots__
10+
tmp

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "0.3.0",
44
"description": "Color components (ColorPicker) for React Material-Ui. No dependencies. It uses Hooks and support RGBA, HSVA, and more !",
55
"main": "index.js",
6-
"types": "index.d.ts",
6+
"module": "./esm/index.js",
7+
"typings": "index.d.ts",
78
"repository": "https://github.com/mikbry/material-ui-colorpicker.git",
89
"author": "Mik <[email protected]>",
910
"license": "MIT",

rollup.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export default {
2525
'react-is',
2626
'hoist-non-react-statics',
2727
'styled-components',
28+
'Element',
29+
],
30+
output: [
31+
{ file: './dist/esm/index.js', format: 'esm', sourcemap: true },
32+
{ file: './dist/index.js', format: 'cjs', sourcemap: true },
2833
],
29-
output: [{ file: './dist/index.js', format: 'esm', sourcemap: true }],
3034
plugins: [babel(), resolve({ extensions: ['.js', '.jsx'] }), terser()],
3135
};

src/components/ColorButton.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ColorButton.propTypes = {
111111
/**
112112
Internal usage
113113
*/
114-
forwardRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
114+
forwardRef: PropTypes.shape({ current: PropTypes.elementType }),
115115
};
116116

117117
ColorButton.defaultProps = {

src/components/ColorInput.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ColorInput.propTypes = {
119119
Internal usage
120120
*/
121121
enableErrorDisplay: PropTypes.bool,
122-
forwardRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
122+
forwardRef: PropTypes.shape({ current: PropTypes.elementType }),
123123
};
124124

125125
ColorInput.defaultProps = {

src/components/ColorPalette.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ColorPalette.propTypes = {
5454
borderWidth: PropTypes.number,
5555
size: PropTypes.number,
5656
palette: CommonTypes.palette.isRequired,
57-
forwardRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
57+
forwardRef: PropTypes.shape({ current: PropTypes.elementType }),
5858
onSelect: PropTypes.func,
5959
/**
6060
Don't use alpha

0 commit comments

Comments
 (0)