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

Can not minify React app using request-network.js #57

Closed
mikery opened this issue Aug 6, 2018 · 2 comments
Closed

Can not minify React app using request-network.js #57

mikery opened this issue Aug 6, 2018 · 2 comments

Comments

@mikery
Copy link
Contributor

mikery commented Aug 6, 2018

Hi, I'm trying to use request-network.js from a React app, and I am running into a problem with the minify setup. This is not a problem with the Request library per se, but it might be something that can be most easily fixed on your end. Running npm run build results in this error:

> [email protected] build /private/tmp/test/test
> react-scripts build

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

 	./node_modules/ipfs-api/src/utils/module-config.js:7 

Read more here: http://bit.ly/2tRViJ9

The link suggests that publishing ES5 compiled versions of the code will resolve this.

Steps to reproduce:

create-react-app test-app
cd test-app
# Before installing the library the project builds ok
npm build  
npm install @requestnetwork/request-network.js --save
npm install  # Had to run install again to reinstall react-scripts
# Add the following to test-app/src/App.js:
import RequestNetwork, {Types} from '@requestnetwork/request-network.js';
# The build will now fail
npm run build

I have temporarily worked around this by disabling the minify step, but that leads to a 2MB JS bundle.

Is publishing ES5 compiled versions of the library something the team can do? JS is not really my area, so I'm not sure how much work is involved in this.

@romaric-juniet
Copy link
Contributor

romaric-juniet commented Aug 14, 2018

I'm not entirely sure what's going in with js-ipfs.
js-ipfs has fixed the issue ipfs/js-ipfs#1321
but it's not fixed on js-ipfs-api although the last comment refers to js-ipfs ipfs-inactive/js-ipfs-http-client#611

the easiest is to use the v2 of create-react-app, I just tested in local and it works with "react-scripts": "^2.0.0-next.3e165448"

fyi, https://github.com/RequestNetwork/js-ipfs-api has been synced with js-ipfs-api and the error persists

@romaric-juniet
Copy link
Contributor

create-react-app 2 being released, this issue can be closed. Feel free to comment or reopen if it's not the case

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