Skip to content

Commit

Permalink
fix(esm): make ESM exports explicit in index.mjs and utilities.mjs
Browse files Browse the repository at this point in the history
Fixes #1228

Vite fails with the error:

```
Uncaught SyntaxError: The requested module '/@fs/Users/.../node_modules/.vite/app/deps/html-react-parser.js?v=719515aa' does not provide an export named 'Element' (at list.tsx:6:31)
```
  • Loading branch information
remarkablemark committed Dec 18, 2023
1 parent 8cc2c36 commit 3e0fd2b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion esm/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import HTMLReactParser from '../lib/index.js';

export * from '../lib/index.js';
export {
Comment,
Element,
ProcessingInstruction,
Text,
attributesToProps,
domToReact,
htmlToDOM,
} from '../lib/index.js';

export default HTMLReactParser.default || HTMLReactParser;
9 changes: 8 additions & 1 deletion esm/utilities.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
export * from '../lib/utilities.js';
export {
isCustomComponent,
setStyleProp,
PRESERVE_CUSTOM_ATTRIBUTES,
ELEMENTS_WITH_NO_TEXT_CHILDREN,
canTextBeChildOfNode,
returnFirstArg,
} from '../lib/utilities.js';

0 comments on commit 3e0fd2b

Please sign in to comment.