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

Import syntax #85

Open
aral opened this issue Feb 17, 2025 · 0 comments
Open

Import syntax #85

aral opened this issue Feb 17, 2025 · 0 comments

Comments

@aral
Copy link

aral commented Feb 17, 2025

In Node (latest LTS):

import { toXML } from 'jstoxml'

Results in the following error:

import { toXML } from 'jstoxml'
           ^^^^^
  SyntaxError: The requested module 'jstoxml' does not provide an export named 'toXML'

Workaround

Use:

import transform from 'jstoxml'
transform.toXML()

From the source code in the installed module, I don’t understand why this doesn’t work but the main in the package.json file doesn’t point to the source file but to the built file in dist and whatever transformations are done to generate the file may be where the problem is.

PS. Thanks for making and sharing this :)

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

No branches or pull requests

1 participant