typescript: Memory usage of nuxt dev with typescript grows indefinitely
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:
- Create a project using
yarn create nuxt-app myproject. Choose typescript for the programming language and use default for all other options. - Run
yarn dev - Open nuxt.config.js in your editor and just save it to trigger a nuxt build.
- Repeat 3. a couple times.
- 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):

Language: javascript (expected):

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)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 21 (10 by maintainers)
@Eygle
nuxt-edgealready includes this PR, which is why I asked people to test with it πIβm not sure how can I help if itβs also reproducible without TypeScript π