Skip to content

Vuex Devtools plugins registered on server which increases memory usage #2250

Open
@urbnjamesmi1

Description

@urbnjamesmi1

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

  1. Use Vuex 4.0.2 with Vue 3 with SSR on a Node server process while running with NODE_ENV=development
  2. Make sure the usage includes registering store modules at runtime
  3. Notice that as the server processes more requests that use Vuex, the memory used by the server will rise and not come down.
  4. 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.

Additional context

No response

Validations

  • Follow our Code of Conduct
    Read the docs.
    Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Activity

added a commit that references this issue on Jul 15, 2024
e06ad55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Vuex Devtools plugins registered on server which increases memory usage · Issue #2250 · vuejs/vuex