Search code examples
node.jsecmascript-6requirewebstormtemplate-strings

Webstorm string templates using backticks(`)


I just upgraded to the last version of WebStorm(11.0).

I have in my code require in that syntax:

let path = require(`../../assets/js/templates/${thisTemplate}`);

The problem is that WebStorm says:

Module is not installed

And if I hit the yellow bulb I get suggestion:

Install '`..'

P.S. Before, when I used the older version(10.X-don't remember which exactly), I got no errors.


Solution

  • That's a result of new Node.js inspection Missing module dependency. Reported an issue that you can follow: https://youtrack.jetbrains.com/issue/WEB-18919

    As a workaround for now please disable that inspection manually by going to Preferences | Editor | Inspections - JavaScript - Node.js - Missing module dependency or hit alt-enter on the highlighted error then hit Arrow right and select Disable inspection.