-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin import in angular project throws error 'no default export' #613
Comments
Please provide a test repo. |
Use import * as dayjs from 'dayjs';
import * as weekday from 'dayjs/plugin/weekday';
dayjs.extend(weekday); |
Ok, here is the thing, we have same or equal issues with Which is described as: Does not support namespaces. Workaround: Move to using file exports, or migrate to using the module { } syntax instead. Does not support const enums because those require type information to compile. Workaround: Remove the const, which makes it available at runtime. Does not support export = and import =, because those cannot be compiled to ES.next. Workaround: Convert to using export default and export const, and import x, {y} from "z". https://babeljs.io/docs/en/babel-plugin-transform-typescript.html |
the only workaround which works, is to setup tsconfig with
|
https://day.js.org/docs/en/installation/typescript this might help |
I'll close this issue since it's been a while since it's been opened. Feel free to reopen if you have updates on this |
Describe the bug
Plugin import throws error in angular project / browser
dayjs__WEBPACK_IMPORTED_MODULE_5__(...).month(...).startOf(...).weekday is not a function
Expected behavior
I can use most dayjs functions just fine with
import * as dayjs from 'dayjs'
.But when I need to use plugins, I import with
import * as weekday from 'dayjs/plugin/weekday
, it throws me this error in the browser - even though the compiler recognises the function weekday just fine:dayjs__WEBPACK_IMPORTED_MODULE_5__(...).month(...).startOf(...).weekday is not a function
Trying to import the weekday plugin with
import weekday from 'dayjs/plugin/weekday';
throws compiler errorModule '"C:/.../node_modules/dayjs/plugin/weekday"' has no default export.
OR
import { weekday } from 'dayjs/plugin/weekday';
throws compiler errorModule '"C:/.../node_modules/dayjs/plugin/weekday"' has no exported member
Information
The text was updated successfully, but these errors were encountered: