Recently upgraded Vuex to 4.0.2 for a Vue 3 migration that uses a custom SSR solution using Express and Webpack. When running in development mode, the server's memory continued to rise with usage, whereas in production mode, it didn't happen.
Ran a profiler via Chrome's devtools and noticed that in development mode, there were large memory allocations for the VUE_DEVTOOLS_PLUGINS. We also use vue-i18n and vue-router which also register devtools plugins when running in development mode.
However, those other libraries make a check that they are executing in the browser or not in a Node environment, but Vuex does not. As long as you are running in development mode (even on the server) it registers the devtools plugins. I believe this is the cause of the sustained memory usage (possibly a leak?).
I will submit a PR to fix this issue.
Reproduction
Use Vuex 4.0.2 with Vue 3 with SSR on a Node server process while running with NODE_ENV=development
Make sure the usage includes registering store modules at runtime
Notice that as the server processes more requests that use Vuex, the memory used by the server will rise and not come down.
Notice that the same thing doesn't happen if you run the server with NODE_ENV=production
Expected behavior
Vuex not to add devtools on the server (even if NODE_ENV=development), client-side is fine.
Version
4.0.2
Describe the bug
Recently upgraded Vuex to 4.0.2 for a Vue 3 migration that uses a custom SSR solution using Express and Webpack. When running in development mode, the server's memory continued to rise with usage, whereas in production mode, it didn't happen.
Ran a profiler via Chrome's devtools and noticed that in development mode, there were large memory allocations for the VUE_DEVTOOLS_PLUGINS. We also use vue-i18n and vue-router which also register devtools plugins when running in development mode.
However, those other libraries make a check that they are executing in the browser or not in a Node environment, but Vuex does not. As long as you are running in development mode (even on the server) it registers the devtools plugins. I believe this is the cause of the sustained memory usage (possibly a leak?).
I will submit a PR to fix this issue.
Reproduction
Expected behavior
Vuex not to add devtools on the server (even if NODE_ENV=development), client-side is fine.
Additional context
No response
Validations