(node modules) Cannot resolve file using import syntax

Hi there,

I have just imported one of my projects, which utilizes Webpack, Babel and pixi.js npm modules, into WebStorm. The project is almost finished, previously authored in VS Code using ES6 import syntax to import the 'pixi.js' module on every JS file: 

import * as PIXI from 'pixi.js';

I have installed the pixi.js module properly and the intellisense in VS Code worked pretty well with that module. I have also used Webpack to bundle the project, and the bundled app worked very well. However, in the WebStorm editor, the text 'pixi.js' is marked with an warning Cannot resolve file 'pixi.js', with all the sub-module/functions marked as Unresolved type ***.

I then experimented with the require() syntax, as in:

const PIXI = require('pixi.js');

This time no errors occurred and all the usages below were recognized.

The language version in WebStorm Preferences is already set to "ECMAScript 6", and "Node.js Core library" is also enabled. I can also see "pixi.js" recognized under "Packages" with its latest version installed on the same page.

Although now I can now use pixi.js using the require() statement in WebStorm, I would still prefer the "import" version for a unified style, and would like to know the reason why WebStorm cannot resolve this module. The import statements with other modules worked fine in WebStorm with my current settings.

Could anyone help me with this problem?

Thank you in advance!

1
1 comment

This is a known issue unfortunately, please follow https://youtrack.jetbrains.com/issue/WEB-25805 for updates

0

Please sign in to leave a comment.