Skip to content

Commit

Permalink
Should not be an error when importing non-React functions in non-Reac…
Browse files Browse the repository at this point in the history
…t projects
  • Loading branch information
dumbmatter committed Aug 4, 2024
1 parent 723ab5e commit 305c1de
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# 4.2.2 (2024-08-04)

- The `Face` React component should now be imported as:

```javascript
// New correct way
import { Face } from "facesjs/react";
```

Rather than the way it was imported in version 4.2.0:

```javascript
// Old wrong way
import { Face } from "facesjs";
```

The reason is because version 4.2.0 broke importing other facesjs exports in some non-React projects.

# 4.2.1 (2024-05-15)

- #47 - Restore the "shave" facial feature option to the editor, which was accidentally removed in v4.1.0.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const face = generate(undefined, { gender: "female", race: "asian" });
You can use the `display` function within any frontend JS framework, but for ease of use with the most popular one, this package includes a `Face` component for React.

```javascript
import { Face, generate } from "facesjs";
import { generate } from "facesjs";
import { Face } from "facesjs/react";
import { useEffect } from "react";

export const MyFace = ({ face }) => {
Expand Down
24 changes: 18 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,25 @@
}
},
"exports": {
"import": {
"types": "./build/esmodules/index.d.ts",
"default": "./build/esmodules/index.js"
".": {
"import": {
"types": "./build/esmodules/index.d.ts",
"default": "./build/esmodules/index.js"
},
"require": {
"types": "./build/commonjs/index.d.ts",
"default": "./build/commonjs/index.js"
}
},
"require": {
"types": "./build/commonjs/index.d.ts",
"default": "./build/commonjs/index.js"
"./react": {
"import": {
"types": "./build/esmodules/Face.d.ts",
"default": "./build/esmodules/Face.js"
},
"require": {
"types": "./build/commonjs/Face.d.ts",
"default": "./build/commonjs/Face.js"
}
}
},
"main": "./build/commonjs/index.js",
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export { display } from "./display.js";
export { generate } from "./generate.js";
export { faceToSvgString } from "./faceToSvgString.js";
export { Face } from "./Face.js";

// Usually not needed, but just in case...
export { default as svgs } from "./svgs.js";
Expand Down

0 comments on commit 305c1de

Please sign in to comment.