A module cannot have multiple default exports
Solution 1
Quick Way
As sometimes you can just reopen a file as stated in other answers, it doesn't always help, however.
Update: Dec 10, 2020. The previous option (see below) is not available in new versions of WebStorm. To restart the TS service now, you can use the following option:
See more details on TypeScript tool window help center page.
Previous functionality (prior versions)
When you see lags like this one (and other weirdness from TS service), you can restart the TypeScript service by opening a TypeScript tool window and clicking on the "Restart" button (3rd button on the right side of the panel):
Solution 2
I had the same error. After restarting WebStorm it worked again.
Solution 3
Quickest way: Close and reopen the file!
Related videos on Youtube
MARCKON LIU
Updated on December 11, 2020Comments
-
MARCKON LIU over 3 years
I have only one
export default
line in my code. However, in WebStorm with Typescript, I get this TS Error:Ts2528: a module cannot have multiple default exports
Here is the code:
ts import { ModelCreator } from 'entities/model-creator' export default ModelCreator()
-
Serhii Matrunchyk over 3 yearswanna make some answer accepted?
-
-
Nic Scozzaro over 4 yearsSame issue in PyCharm
-
Athul Muralidharan about 4 yearsSame issue in IntelliJ Idea
-
PANKAJ NAROLA about 4 yearsfor me, it worked just after reopening the file. so for ex: close the file which shows this error and reopen it. so, in this case, u can save the time of restarting a webstorm.. I hope it helps to someone.
-
MyStackRunnethOver over 3 yearsThis solved my Intellij "A module cannot have multiple default exports" error as well
-
Taki over 3 yearsDefinitely better than restarting IDE. However still reproducible on PhpStorm 2020.2.3
-
David Gilbertson over 3 yearsPity they merged TypeScript into the Problems pane in 2020.3, I can't see how to restart TypeScript now.
-
Harry over 2 yearsThank you! This tip still paying dividends in 2021 with a react component issue I had with a default export
-
Serhii Matrunchyk over 2 yearsUpd: Seems like this update resolved the issue finally youtrack.jetbrains.com/issue/WEB-47248