Mobx-state-tree: ES6 in published middleware

Created on 10 Oct 2017  Â·  5Comments  Â·  Source: mobxjs/mobx-state-tree

I ran into an issue when using the new TimeTraveller middleware. Distributed npm code hasn't been fully transpiled to es5. It says here "The middlewares must be written in valid ES5. ES imports / exports are allowed."

I wouldn't have noticed, but uglifyjs complains :)

Why not run babel on each file with module transpilation disabled in the build step?

I'm happy to do a PR with whatever you think is best.

Most helpful comment

Ok, just done in #446 , now create-react-app is also able to build and does'nt complain about missing full-es5 transpilation. This should fix your use-case @paul-veevers !

All 5 comments

Feel free to PR! Preferably we do keep the ES imports / exports (I think it
depends on the uglify version whether that is supported or not), as without
ES modules mobx-state-tree cannot be tree-shaken anymore when using these
middlewares

Op di 10 okt. 2017 om 12:30 schreef Paul Veevers notifications@github.com:

I ran into an issue when using the new TimeTraveller middleware.
Distributed npm code hasn't been fully transpiled to es5. It says here
https://github.com/mobxjs/mobx-state-tree/blob/master/middleware/README.md#contributing
"The middlewares must be written in valid ES5. ES imports / exports are
allowed."

I wouldn't have noticed, but uglifyjs complains :)

Why not run babel on each file with module transpilation disabled in the
build step?

I'm happy to do a PR with whatever you think is best.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mobxjs/mobx-state-tree/issues/445, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABvGhMn5LV7rIs9hsSMI80RO-GCLWxeSks5sq0dFgaJpZM4Pztil
.

I've encountered this issue while working on #446 , and I was thinking about moving middlewares to a separate package, have them written in TS and fully transpiled. Is fine for anyone?

+1

Op di 10 okt. 2017 om 19:13 schreef Mattia Manzati <[email protected]

:

I've encountered this issue while working on #446
https://github.com/mobxjs/mobx-state-tree/pull/446 , and I was thinking
about moving middlewares to a separate package, have them written in TS and
fully transpiled. Is fine for anyone?

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/mobxjs/mobx-state-tree/issues/445#issuecomment-335544102,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABvGhPBo4SKUvpJaM70uxZLN2fvwaT3Jks5sq6WrgaJpZM4Pztil
.

Ok, just done in #446 , now create-react-app is also able to build and does'nt complain about missing full-es5 transpilation. This should fix your use-case @paul-veevers !

Fixed, will be out with next release

Was this page helpful?
0 / 5 - 0 ratings