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

Issue importing into browser with typescript #9

Closed
paustint opened this issue Mar 1, 2020 · 2 comments
Closed

Issue importing into browser with typescript #9

paustint opened this issue Mar 1, 2020 · 2 comments

Comments

@paustint
Copy link

paustint commented Mar 1, 2020

I am having issues included this library in the browser. It appears that this library is using node only APIs (e.x. fs). I am using typescript and webpack.

[0] ERROR in ./node_modules/tXml/tXml.js
Module not found: Error: Can't resolve 'fs' in '.../node_modules/tXml'

I have tried importing a few different ways without any success
import { xml as tXml, simplify } from 'tXml';
import * as tXml from 'tXml';

Also, it appears that either the README is out of data or that the typescript definitions generated are incorrect, as the type definition does not match the README examples.

@TobiasNickel
Copy link
Owner

sorry for the late reply, and thanks for opening this issue, I just published a new version 3.1.3, that is setting the "browser": { "fs": false } in the package.json. So now webpack can build this package with no problem.
Processing streams of course will still only work in node.

second, make sure to import txml lower case. not tXml, or actually, I am not sure why the foldername in your node_modules has the uppercase X. The module name is lower case: https://www.npmjs.com/package/txml

again: thank you !!

@TobiasNickel
Copy link
Owner

👍

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

2 participants