Dynalon / reactive-state

Redux-clone build with strict typing and RxJS down to its core. Wrist-friendly, no boilerplate or endless switch statements
MIT License
138 stars 7 forks source link

Transpiled code is ES6 instead of ES5 #10

Closed Ronsku closed 6 years ago

Ronsku commented 6 years ago

Hi,

I upgraded reactive-state from 0.4.5 -> 0.5.3 (No idea what the version updates with 0.8.x in between are, but they are obviously not pushed to the NPM repository).

I've got issues now with the upgrade since code in src (old dist) is in ES6. Before it was in ES5 as it should. tsconfig.json says target ES5 and that is perfect, but build is wrong currently in latest version.

Screenshot from 0.5.3 (ES6): screen shot 2018-01-11 at 13 06 48

Screenshot from 0.4.5 (ES5): screen shot 2018-01-11 at 13 08 08

I would love to have it in ES5 format like before. Is this a mistake or a change made on purpose?

Thank you Timo!

Dynalon commented 6 years ago

This might be related to the test code, as I compile the code for running in tests to ES6 (for coverage reasons). But at the same time, compiled code should not go to /dist/ any longer (maybe for the tests, but not for consumption/release).

All .js files should go into /src/. Did you import {} directly from reactive-state/dist/* ? If so, try only to import like this: import { Store, Action, Reducer } from 'reactive-state' or, when using the react-bridge: `import { connect } from 'reactive-state/react'

Dynalon commented 6 years ago

Another note: If you cloned reactive-state locally, try a git clean -xfd and re-run npm install && npm run build manually

Ronsku commented 6 years ago

In 0.5.3 there aren't anymore all the dist files. screen shot 2018-01-11 at 13 29 51

also in package.json: "main": "src/index.js", so when you just import import { Store, Action, Reducer } from 'reactive-state' it will always go to the src/.

Ronsku commented 6 years ago

Yes, everything goes into src/-folder and also the package.json-linking. All files in src/ are ES6. Could src/-folder files be in ES5 in NPM repository?

Dynalon commented 6 years ago

Uuuh my bad, the "npm run build-test" actually replaces the src/ files with ES6 versions, and I accidentally published those. Just publish v0.5.4 that fixes this. Will need to find another solution for the test compiltion.

Dynalon commented 6 years ago

I registered a prepublish hook that should prevent this happening in the future.

Ronsku commented 6 years ago

Amazing! Thank you once again! 👍 :)