WebStorm Auto import - "require" instead of "import from"

Guy

Working on a Node.js project I get suggestions (Alt + Enter) to import using ES6 when my Node.js does not support the import statement. Can I add suggestions that use require? Auto import saves so much time...

auto import

The manipulateName method definition:

const manipulateName = (layout, method) => {
    layout.name = method(layout.name);
    return layout;
}

and ...

module.exports = {
    manipulateName,
 ...
}
lena

Please make sure that Node.js Core library is enabled for your project (Preferences | Languages & Frameworks | Node.js and NPM, Node.js Core library).

See Missing require() statement inspection (Preferences | Editor | InspectionsJavaScript | Node.js) description:

Checks that all modules are referenced through "require()".
Suggests inserting the "require()" call.
Works only in files in the scope of "Node.js Core" JavaScript library.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related