Very high CPU usage using pnpm

See original GitHub issue

Maybe I’ve done something wrong but even with the dumbest config ever I feel like I have an error while running nollup in order to get HMR working for my CSS and Javascript.

I always get this output in the terminal whatever config I’m using (tried many, from some other repos, etc). The only way for me to get it working is by using the examples as it from the examples folder of this repo, which calls the cli from a javascript file. When I try to use the nollup -c command, that’s when issues are coming by.

> npm run dev

> test-nollup@1.0.0 dev /Users/user/Desktop/Rollup
> nollup -c --hot --port 3000

Listening on http://localhost:3000
Compiled in 944ms.
Compiled in 441ms.
^C%

Also the node process in my Activity monitor goes off the roof with at least 300% CPU.

This is my package.json

{
  "name": "test-nollup",
  "version": "1.0.0",
  "description": "",
  "private": true,
  "scripts": {
    "build": "cross-env NODE_ENV=development nollup -c nollup.config.js -w --hot --content-base build --port 3000 --verbose",
    "dev": "nollup -c --hot --port 3000"
  },
  "dependencies": {
    "normalize.css": "^8.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.8.3",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/plugin-transform-runtime": "^7.8.3",
    "@babel/preset-env": "^7.8.3",
    "@babel/runtime": "^7.8.3",
    "@rollup/plugin-commonjs": "^11.0.1",
    "@rollup/plugin-node-resolve": "^7.0.0",
    "@rollup/plugin-replace": "^2.3.0",
    "autoprefixer": "^9.7.4",
    "cross-env": "^6.0.3",
    "eslint-config-standard": "^14.1.0",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-node": "^11.0.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.1",
    "node-sass": "^4.13.1",
    "nollup": "^0.10.2",
    "postcss": "^7.0.26",
    "postcss-banner": "^3.0.1",
    "postcss-preset-env": "^6.7.0",
    "rollup": "^1.29.0",
    "rollup-plugin-babel": "^4.3.3",
    "rollup-plugin-banner": "^0.2.1",
    "rollup-plugin-browsersync": "^1.1.0",
    "rollup-plugin-bundle-html": "^0.2.2",
    "rollup-plugin-clear": "^2.0.7",
    "rollup-plugin-dev": "^1.1.1",
    "rollup-plugin-eslint": "^7.0.0",
    "rollup-plugin-hot-css": "^0.0.6",
    "rollup-plugin-postcss": "^2.0.3",
    "rollup-plugin-serve": "^1.0.1",
    "rollup-plugin-terser": "^5.2.0"
  },
  "browserslist": [
    "> 0.5%",
    "last 2 versions",
    "not dead"
  ]
}

and my rollup.config.js

import resolve from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import commonjs from '@rollup/plugin-commonjs'
import babel from 'rollup-plugin-babel'
import devserver from 'rollup-plugin-dev'
import browsersync from 'rollup-plugin-browsersync'
import postcss from 'rollup-plugin-postcss'
import clear from 'rollup-plugin-clear'
import html from 'rollup-plugin-bundle-html'
import banner from 'rollup-plugin-banner'
import { terser } from 'rollup-plugin-terser'
import { eslint } from 'rollup-plugin-eslint'
import pkg from './package.json'
// import settings from './settings.json'

// Define environment and things
const mode = process.env.NODE_ENV
const watch = process.env.ROLLUP_WATCH
const dev = mode === 'development'
const workdir = dev ? 'build' : 'dist'

// Rollup config
export default {
	input: 'src/main.js',
	output: {
		dir: dev ? 'build' : 'dist',
		entryFileNames: '[name]-[hash].js',
		chunkFileNames: '[name]-[hash].js',
		sourcemap: dev,
		format: 'cjs'
	},

	// Plugins
	plugins: [
		// Clean
		// clear({
		// 	targets: [ workdir ],
		// 	watch: true
		// }),

		// Serve
		// dev && watch && devserver({
		// 	port: 3100,
		// 	dirs: [ workdir ],
		// 	basePath: '/'
		// }),
		// dev && watch && browsersync({
		// 	port: 3000,
		// 	proxy: 'http://localhost:3100',
		// 	open: false,
		// 	notify: false
		// }),

		// PostCSS with SASS/SCSS/Stylus
		// postcss({
		// 	extract: true,
		// 	sourceMap: dev
		// }),

		// Javascript
		// replace({
		// 	'process.browser': true,
		// 	'process.env.NODE_ENV': JSON.stringify(mode)
		// }),
		// resolve({
		// 	browser: true
		// }),
		// commonjs(),
		// eslint({
		// 	exclude: ['**/*.scss', 'node_modules/**']
		// }),
		// babel({
		// 	extensions: ['.js', '.mjs', '.html'],
		// 	exclude: ['node_modules/**'],
		// 	runtimeHelpers: true
		// }),

		// Build
		// html({
		// 	template: 'src/template.html',
		// 	dest: workdir,
		// 	filename: 'index.html'
		// }),
		// !dev && terser({
		// 	module: true,
		// 	output: {
		// 		comments: false
		// 	}
		// }),
		// !dev && banner(`${pkg.name} v${pkg.version}\nBy ${pkg.author.name}\n${pkg.author.url}`)
	]
}

Am I missing something ? 🤪

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
flaykscommented, Jan 24, 2020

Looks good to me! Thanks for the fix.

1reaction
PepsRyuucommented, Jan 23, 2020

Great! I should hopefully have a fix for the first issue by tomorrow. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntelliJ pnpm indexing high cpu usage : WEB-56497
using pnpm on Astro repo, updating dependencies, then, while IDE indexing, my laptop unusable, I kill the process after waiting 1 hour.
Read more >
Maxed out CPU usage caused by high received data? - Forum
The server however is being maxed out continuously (95-100%) and it seems like a lot of data is being received by the server...
Read more >
Managing a full-stack, multipackage monorepo using pnpm
Learn why pnpm performs better than npm and how the many special workspaces features make it ideal for managing a multi-package monorepo.
Read more >
rushstack/rushstack - Gitter
No, it's supposed to control CPU usage, not memory allocations. ... NodeJS does have a maximum per-process limit, which can be tuned using...
Read more >
Monorepo slows down my i5 8th gen , 8gb ram laptop
Currently I am contributing a repo which is using pnpm for the ... Ubuntu which I can use to speed up the compilation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found