"Default export is not declared in imported module"

I'm using ES2015/2016 in my project, and I have some node modules pulled in, which are in regular ES5. When I try importing one of the modules using ES2015 syntax (for example, "import glob from 'glob';"), I get a warning "default export is not declared in imported module." ES5 doesn't support the "export default" declaration which would make this warning go away.

However, I would presume that the equivalent in ES5 would be to use exports.module = ..., which is what most libraries do, and importing the default export works just fine when using ES5 libraries.

I would either like a way to disable this warning (as there doesn't seem to be a way to do so) or ideally, this warning should not be shown in these cases.

7 comments

https://youtrack.jetbrains.com/issue/WEB-18519 is fixed in WebStorm 11.0.3. If this doesn't work for you, please can you provide a sample project that shows up the issue?

0

I created an express project from the default express template, changed the language to ES6, and changed one of the require's to an ES6 import. The warning still shows up. My current WebStorm version is 11.0.3.

Here is a zip link for the test project I made: https://drive.google.com/file/d/0B4n-SMSDGa_gQUg3SzJSaFpSTDg/view?usp=sharing

0

Hi Elena, this is kind of a major issue. Why is it only fixed in WebStorm 12 EAP instead of WebStorm 11? Is this to say that WebStorm 11 will never get this fix? Thanks.

1

 It is very unlikely that WebStorm 11 will get this fix, as it's a part of massive changes made for version 12.

0

This seems to have regressed. I am experiencing this behavior in IntelliJ IDEA 2018.3 EAP. What's more is that the inspection seems to be invalid, as the function is exported from the module.

 

0

WebStorm uses typings (if they are available) for modules resolving/completion. Winston-cloudwatch package includes typings, but node_modules/winston-cloudwatch/typescript/winston-cloudwatch.d.ts has no default export declared. So the warning is expected...

0

Please sign in to leave a comment.