In my project(Next.js v10), the immutable library is used to work with redux. Now I tackled the issue of optimization, because I ran into the problem of "red" first load js.
I am not very strong in this yet, but I try to learn and understand everything. I applied dynamic import on the pages themselves, as it is advised everywhere, and it helped a lot, since the situation was even worse than now. I checked _document.js and _app.js, everything seems to be fine except:
//_app.js
const {serialize, deserialize} = require('json-immutable');
...
const wRedux = withRedux(makeStore, {
serializeState: state => state ? serialize(state) : state,
deserializeState: state => state ? deserialize(state) : state
})(MyApp);
export default wRedux;
As it works now, I get:
If I turn off the use of serialize and deserialize completely (in _app.js), and index.tsx (no redux request and no imports other than React) just returns an empty div => I get this:
const wRedux = withRedux(makeStore, {
serializeState: state => state,
deserializeState: state => state
})(MyApp);
Some chunks are missing, but the immutable chunk remains in place( though for some reason its size is slightly different, but the hash is the same):
I found this article: https://betterprogramming.pub/try-these-instead-of-using-immutable-js-with-redux-f5bc3bd30190 and check https://www.npmtrends.com/immutable-vs-immer-vs-seamless-immutable
The problem is that the whole project is already on the syntax immutable-js (post.get ('prop'))
My questions:
- How much better Immer will be?
- Will he(Immer) also "go into the general chunk"?
- What other ways are there to reduce the size of "First Load JS shared by all"?
- Perhaps there are some other shortcomings that I do not notice due to lack of experience, but they can be seen on the reports?
Thanks for any help!