I'm using KVision redux and I'm getting this warni...
# kvision
a
I'm using KVision redux and I'm getting this warning in my logs, what the best way to conditionally make Redux switch to production?
Copy code
main.bundle.js:2 You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (<https://github.com/zertosh/loose-envify>) for browserify or setting mode to production in webpack (<https://webpack.js.org/concepts/mode/>) to ensure you have the correct code for your production build.
I'm using the Gradle task
browserProductionWebpack
, is there a way to set an option to that, so it's only production when I'm building for production?
r
I think it's the problem with KVision redux module. The module imports
redux/dist/redux.js
directly and that is clearly wrong because it'a development build.
Please open an issue - I'll experiment what should I import to make it work correctly.
a
r
BTW why do you use redux module? I use to think of this module as deprecated 🙂 and prefer
StateFlow
in my projects.
a
I think because that's what I saw when I reading through kvision.gitbook.io
r
I see 🙂 No worry - the module is not going anywhere 😉
a
haha I wasn't worried about that
I think from looking at the docs for StateFlow the example was a bit more basic, so I didn't think it fitted the use case
r
You can use StateFlow the same way you use Redux store. This collect operation is all you need: https://github.com/rjaros/kvision-examples/blob/master/fomantic/src/main/kotlin/com/example/App.kt#L32-L36 You can use exactly the same reducer function, the same state and the same actions. And just emit actions using SharedFlow instead of dispatching actions to the store.
Of course redux is still good solution - especially when you don't need and want to depend on kotlinx.coroutines and probably keep your bundle size smaller.