File is a CommonJS module; it may be converted to an ES module

This is a new feature added in Visual Studio Code called “Suggestion Code Actions”. “Suggestion Code Actions” are enabled by default in JavaScript and TypeScript.

You can disable them by setting: "typescript.suggestionActions.enabled": false or "javascript.suggestionActions.enabled": false in your user/workspace settings. The documentation can be found here.

open settings.json file

insert below option

{
    "javascript.suggestionActions.enabled": false, // disable vscode alert on javascript
    "typescript.suggestionActions.enabled": false // disable vscode alert on typescript
}

[Preview Example] it should be looks like:

disable vscode alert File is a CommonJS module; it may be converted to an ES module | WMI - https://i.stack.imgur.com/2AUwp.png

This solution also fix vscode alerts below

  • fix vscode alert This may be converted to an async function.