Search code examples
javascriptintellij-idealint

IntelliJ - Unresolved JavaScript Reference


I'm writing Javascript on IntelliJ with some env variable use, ex.

const DEBUG = process && process.env.COMMAND_DEBUG === 'true';

But the IDE told me Unresolved variable or type process.

So I tried to switch to this form

import { env } from 'node:process';
const DEBUG = env.COMMAND_DEBUG === 'true';

But I've always a warn on this subject (cf. image).

I'm new to IntelliJ Ultimate version 2023.1.2 with NodeJs and it seems that JavaScript comes with some bundled plugins like JavaScript and TypeScript plugin (we dont have it in IntelliJ Community Edition).

Do you know how could I switch off this warn only for this use case (cause it could be usefull in other case) ?

inspection profile JSandTS plugin Unresolved JavaScript Reference


Solution

  • In Intellij IDEs by default you are working in a "browser" environment. For Node.js specific completions and analysis you have to enable it for the project in the settings.