wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.18k stars 31 forks source link

Extension causes high cpu load #846

Closed HiepPP closed 1 year ago

HiepPP commented 1 year ago

quokka.txt

import axios from "axios";

const plus = (a: number, b: number) => a + b;

plus(1, 5);

const minus = (a: number, b: number) => a - b;

minus(1, 4);

const get = async () => {
    const res = await axios.get("https://api.publicapis.org/entries");
    console.log(res.data);
}

get();
smcenlly commented 1 year ago

We are fairly certain that the problem that you are experiencing is caused by wix.vscode-import-cost and not Quokka. Your CPU profile shows a lot of lstat calls to the file system. The trace is limited but we're guessing this is coming from the Import Cost package because Quokka doesn't make any of those calls.

Under the covers, when you install a dependency with Quokka, Quokka is just running npm install {packageName} and does not do any other processing of the package during installation.

To confirm that the problem is not related to Quokka, can you please try the following:

  1. With Quokka installed, uninstall or disable wix.vscode-import-cost and check whether you still have a problem when importing the file.

You should not see any high CPU at this point in time

  1. With wix.vscode-import-cost installed, uninstall or disable Quokka and then open the file with the same contents in VS Code. Make sure the focus is in the text editor containing the import statement. In a separate terminal instance, install axios using your package manager (e.g. npm install).

You should see high CPU when the package is installing


There are a number of seemingly related issues in the Wix Import Cost issue registry:

https://github.com/wix/import-cost/issues/274 https://github.com/wix/import-cost/issues/272 https://github.com/wix/import-cost/issues/266


We are going to close this issue. Suggest reporting to https://github.com/wix/import-cost/.