No default export (1.8.4)
See original GitHub issueWith v1.8.4 I got the following error:
import dayjs from 'dayjs';
Module ‘“…/node_modules/dayjs/index”’ has no default export.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:22 (11 by maintainers)
Top Results From Across the Web
VS Code tips — Convert default export to named ... - YouTube
Today's VS Code refactoring: convert default export to named exportSafely convert between default exports and named exports in JavaScript ...
Read more >error TS1192: Module '" A.module"' has no default export
This was a simple error. It occurred due to the missing {} around the module name in the import statement itself.
Read more >Documentation - Modules - TypeScript
Each module can optionally export a default export. Default exports are marked with the keyword default ; and there can only be one...
Read more >Overview of Oracle Data Pump
For privileged users, a default directory object is available. ... 1.8.4 Using Substitution Variables with Oracle Data Pump Exports.
Read more >TLS_MGM module - openSIPS
It also exports pseudo variables with certificate and TLS parameters. ... 1.8.4. private_key ([domain](string) ... No default value. Example 1.15.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I’m getting this. I don’t have time to setup a toy repo and everything, but will post some screenshots of what I’m seeing:
Using:
I see it’s undefined until I apply the
.default
workaround others have mentioned:The logs in ^ should show that just doing
import * as dayjs_ from 'dayjs';
in webpack results in undefined—looks like it’s considering it a default export.But even when I attempt to use es6 import default approach (e.g.
import dayjsAsDefault from 'dayjs';
), it doesn’t get fully resolved. This is after such import:and
dayjsAsDefault
is undefinedPersonally, I’d reopen this until it’s proven to work with Webpack given the popularity of that bundler but up to maintainer of course 😉 For now, we’ll all have imports with comments pointing to this issue
IMO this shouldn’t be closed. Pre-1.8.4 behaviour (
import dayjs from "dayjs";
) is still broken and this is a BC break. We are using dayjs in several in-house apps and packages which depend on each other, and this has just broken our entire stack with a single dependency update. We would really appreciate not having to spend a whole day editing ourimport
code / editingpackage.json
to use a fixed 1.8.3 version on every single app/package.Would you please consider going the extra mile to try and make
import
andrequire
behaviours both work as intended? I can try to help if you give me a few pointers about the specific problem. Thanks a ton!