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

How can I use jszip with Expo (React Native) ? #521

Closed
bertbeck opened this issue May 6, 2018 · 5 comments · Fixed by #614
Closed

How can I use jszip with Expo (React Native) ? #521

bertbeck opened this issue May 6, 2018 · 5 comments · Fixed by #614

Comments

@bertbeck
Copy link

bertbeck commented May 6, 2018

I get "unable to resolve module 'stream' when I try to use jszip in an Expo app.Expo is a javascript only version of React Native.

@eXXeption
Copy link

I am getting this too:

ERROR in ./node_modules/jszip/lib/readable-stream-browser.js
Module not found: Error: Can't resolve 'stream'

I don't think it's related to a specific ui/js framework, as I am using angular6/devextreme while getting this error.

I expect it to be a problem with webpack 4 bundling maybe, as the error occures after upgrading from angular5 to angular6 which is using webpack 4.

@beeing
Copy link

beeing commented May 8, 2018

Yes, having the same issue when building for angular6.

I think the issue is due to package.json main is pointing to ./lib/index which should point to dist folder instead.

@eXXeption
Copy link

@beeing
You can fix the angular build by adding node_modules/jszip/dist/jszip.min.js to the tsconfig -> compilerOptions -> paths

@annelorraineuy
Copy link

Has anyone figured out how to use jszip with react-native?

@annelorraineuy
Copy link

annelorraineuy commented Jul 11, 2018

I fixed this error by installing the unresolved module. So npm i stream --save and then clearing cache and restarting watchman fixed the issue.

mgechev added a commit to mgechev/jszip that referenced this issue Aug 21, 2019
When webpack/rollup or another bundler, implementing the
[`browser-resolve`](https://www.npmjs.com/package/browser-resolve)
spec tries to resolve `jszip` for a browser-based project they fail
with:

```
ERROR in ./node_modules/jszip/lib/readable-stream-browser.js
Module not found: Error: Can't resolve 'stream' in '/node_modules/jszip/lib'
```

Since you already produce a browser build, we just need to point to
it inside of `package.json`'s `browser` field.

PS: You'd probably want to double check the semantics of `"."`.

Looking at `browser-resolve` it seems that everything will work
as expected. Also, trying empirically with webpack, everything worked
out, but few more pairs of eyes would be greatly appreciated.

Also @sokra should be able to share a valuable opinion.

Fix Stuk#524
Fix Stuk#521
Fix Stuk#477
@Stuk Stuk closed this as completed in #614 Apr 1, 2020
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.

4 participants