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

fix: use default import for fast-xml-parser #169

Merged
merged 3 commits into from
Feb 20, 2022
Merged

Conversation

andipaetzold
Copy link
Owner

Named import of fast-xml-parser fails for node versions prior 14.13

The fix is to use the default import instead of named import.

Node versions

Node Version Works?
14.14 (latest) Yes
16.0 Yes
14.18 (latest) Yes
14.13 Yes
14.12 No

Error messages

14.12

import { XMLParser } from "fast-xml-parser";
         ^^^^^^^^^
SyntaxError: The requested module 'fast-xml-parser' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'fast-xml-parser';
const { XMLParser } = pkg;

14.0

import { XMLParser } from "fast-xml-parser";
         ^^^^^^^^^
SyntaxError: The requested module 'fast-xml-parser' does not provide an export named 'XMLParser'

Tickets

fixes #168

@andipaetzold andipaetzold self-assigned this Feb 20, 2022
@andipaetzold andipaetzold added the bug Something isn't working label Feb 20, 2022
@andipaetzold andipaetzold merged commit 4a2ce3e into main Feb 20, 2022
@andipaetzold andipaetzold deleted the fxp-default-import branch February 20, 2022 21:48
github-actions bot pushed a commit that referenced this pull request Feb 20, 2022
## [2.1.1](v2.1.0...v2.1.1) (2022-02-20)

### Bug Fixes

* use default import for fast-xml-parser ([#169](#169)) ([4a2ce3e](4a2ce3e))
@github-actions
Copy link

🎉 This PR is included in version 2.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with nodejs example
1 participant