Skip to content

Memory usage of nuxt dev with typescript grows indefinitely #355

@guaneec

Description

@guaneec

Describe the bug
The memory usage of nuxt with typescript enabled seems to grow unbounded with each reload of nuxt.config.js

To Reproduce
Steps to reproduce the behavior:

  1. Create a project using yarn create nuxt-app myproject. Choose typescript for the programming language and use default for all other options.
  2. Run yarn dev
  3. Open nuxt.config.js in your editor and just save it to trigger a nuxt build.
  4. Repeat 3. a couple times.
  5. Memory usage as reported by nuxt grows indefinitely

Expected behavior
Memory usage should stay below ~500MB

Screenshots
If applicable, add screenshots to help explain your problem.
Language: typescript (bug):
image

Language: javascript (expected):
image

Additional context

With lang=ts, if I run node --trace-warnings node_modules/.bin/nuxt >/dev/null, I get a stack trace:

 ERROR  (node:1066) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 12 exit listeners added to [process]. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:390:17)
    at process.addListener (events.js:406:10)
    at ForkTsCheckerWebpackPlugin.pluginStop ([PROJECT_ROOT]/node_modules/fork-ts-checker-webpack-plugin/lib/index.js:225:17)
    at ForkTsCheckerWebpackPlugin.apply ([PROJECT_ROOT]/node_modules/fork-ts-checker-webpack-plugin/lib/index.js:190:14)
    at webpack ([PROJECT_ROOT]/node_modules/webpack/lib/webpack.js:51:13)
    at [PROJECT_ROOT]/node_modules/@nuxt/webpack/dist/webpack.js:5280:24
    at Array.map (<anonymous>)
    at WebpackBundler.build ([PROJECT_ROOT]/node_modules/@nuxt/webpack/dist/webpack.js:5279:37)
    at async Builder.build ([PROJECT_ROOT]/node_modules/@nuxt/builder/dist/builder.js:5602:5)
    at async Object._buildDev ([PROJECT_ROOT]/node_modules/@nuxt/cli/dist/cli-dev.js:102:5)
    at async Object.startDev ([PROJECT_ROOT]/node_modules/@nuxt/cli/dist/cli-dev.js:60:7)
    at async Object.onWatchRestart ([PROJECT_ROOT]/node_modules/@nuxt/cli/dist/cli-dev.js:131:5)
    at async Nuxt.callHook ([PROJECT_ROOT]/node_modules/hable/dist/hable.js:1:1021)
    at async FSWatcher.<anonymous> ([PROJECT_ROOT]/node_modules/@nuxt/builder/dist/builder.js:6214:9)

Tested on WSL 1 (Ubuntu 18.04.2 LTS)

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