Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot read properties of undefined (reading 'RichTextNodeParser') when used in an Astro project #2

Closed
rshackleton opened this issue Mar 4, 2023 · 4 comments · Fixed by #37
Assignees
Milestone

Comments

@rshackleton
Copy link

Hey, I'm trying to test this in an Astro project but the package doesn't seem to be compatible.

Using the normal import below throws an error.

import { RichTextNodeParser } from '@pokornyd/kontent-ai-rich-text-parser';
const parser = new RichTextNodeParser();
const parsed = parser.parse("<h1>Test</h1>");
Cannot read properties of undefined (reading 'RichTextNodeParser')

However, importing from the dist folder works.

import { RichTextNodeParser } from '@pokornyd/kontent-ai-rich-text-parser/dist/src/parser/node/index';
const parser = new RichTextNodeParser();
const parsed = parser.parse("<h1>Test</h1>");

StackBlitz example of the issue here: https://stackblitz.com/edit/withastro-astro-xgknjr?file=src/pages/index.astro

@pokornyd
Copy link
Member

pokornyd commented Mar 6, 2023

hello Richard, thanks for bringing this to my attention. I'll try to reproduce this and see where the problem comes from.

@pokornyd pokornyd self-assigned this Mar 7, 2023
@pokornyd
Copy link
Member

pokornyd commented Mar 7, 2023

seems to have been caused by discrepancies between es and commonjs module handling, so I build them both (used to be only cjs originally). also slightly refactored the browserParser class which was causing some trouble as well.

version 0.0.14 has been released, so far seems to have addressed the original issue but don't hesitate to test it yourself and let me know if you find any further hiccups.

@rshackleton
Copy link
Author

Looks like 0.0.14 does fix the issue, although there are some issues being flagged by publint that might be worth resolving too.

https://publint.dev/@pokornyd/[email protected]

@Simply007
Copy link
Contributor

Moved to https://publint.dev/@kontent-ai/[email protected] - still the module issue is pending

@Simply007 Simply007 added this to the 1.0.0 milestone Sep 18, 2023
@pokornyd pokornyd linked a pull request Dec 4, 2023 that will close this issue
5 tasks
@pokornyd pokornyd mentioned this issue Dec 5, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants