fjorgemota / jimple

Just a dependency injection container to NodeJS and to the browser using new ES6 features
MIT License
75 stars 12 forks source link

ES5 compilation #25

Closed Poyoman39 closed 6 years ago

Poyoman39 commented 6 years ago

Hi guys,

I sadly discovered that Jimple is not compatible with "create-react-app". It make the build fail with the following error :

Failed to minify the code from this file:

   ./node_modules/jimple/src/Jimple.js:45

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

Any idea about how to fix it ?

homer0 commented 6 years ago

@Poyoman39 The problem is that it's requiring the version on the src folder, which is not ES5. A quick fix that may work is instead of doing require('jimple'), change it to require('jimple/dist/Jimple.js').

Now, the weird thing is that create-react-app uses webpack, and from the documentation and my own experience (I use Jimple + webpack quite a lot), webpack automatically knows whether to use the ES5 or ES6+ version. Maybe create-react-app is doing something weird behind the curtains :P.

I hope this helps!

Poyoman39 commented 6 years ago

Nice ! Thank you it fixed my problem 👍 ... it will be cleaner than puting the jimple.js file in my src folder :D

fjorgemota commented 6 years ago

Hey.

Sorry for the delay in the answer.

@Poyoman39 was the resolve.mainFields correctly configured on your webpack config? I'm a bit curious for what happened on your project.

By the way, thank you all for using this project. =)

Poyoman39 commented 6 years ago

Hey :)

Sorry for the delay of my answer too ;)

Since i'm using create-react-app the webpack configuration is hidden ... and i've no idea about how it may looks like :D

Maybe this may help you : i'm using this version of "react-scripts": "1.1.0" which contains hidden all the webpack config. As i can see inside the webpack files of this node module, there is no trace about any "mainFields"

Hope this helps you :)

By the way too ... thanks for sharing this nice project, and make ioc simple ;)

fjorgemota commented 6 years ago

Oh. I see.

Well, okay then, it's good that you resolved the problem. =)

And you're welcome! Feel free to open new issues if you have doubts, problems or suggestions. )