Skip to content
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

Angular 13 + ngx-moment 6.0.2: This module is declared with using 'export = #275

Open
vadimwe opened this issue Dec 27, 2021 · 9 comments
Open

Comments

@vadimwe
Copy link

vadimwe commented Dec 27, 2021

Multiple error in CLI:
This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

Problem goes away if allowSyntheticDefaultImports: true in tsconfig.json

Did you search for duplicate issue? [Yes / No]
Yes

Please describe the issue and steps to reproduce, preferably with a code sample / plunker:

Angular update till v13.*
Ionic update till 6.*
ngx-moment update to 6.0.2
ionic serve/build

  • Angular version? 13
  • TypeScript version? 4.5.4
  • moment version? 2.29.1
  • Are you using moment-timezone? No
  • Are you using the angular-cli? Yes
  • Using Rollup/Webpack/System.js/Ionic/similar? Yes, Ionic
@AravindMakam
Copy link

I also faced the same issue with 6.0.2. I think the import statement has been changed to 'import 'moment' from moment;'. Should it be 'import * as moment from 'moment';'? I saw this change while trying between 6.0.1 and 6.0.2.

@vadimwe, Meanwhile, I would advise to switch to 6.0.1 and then try to build the solution.

@pete-mcwilliams
Copy link

Back porting to 6.0.1 re-introduces this issue #245

@PillowPillow
Copy link

Enable the allowSyntheticDefaultImports in tsconfig bypass this issue, not sure if the maintainer have to "fix" anything. Maybe for backward compatibility ?

@JaxonWright
Copy link

JaxonWright commented Jan 10, 2022

If the maintainer changes import moment from 'moment'; back to import * as moment from 'moment'; then the allowSyntheticDefaultImports flag would not need to be set to true in your tsconfig of the project using the dependency.

@talynone
Copy link

talynone commented Apr 7, 2022

Will @JaxonWright change ever be implemented?

@Stankman
Copy link

+1

1 similar comment
@tiberioalunni
Copy link

+1

@hassanasad
Copy link

I am sure you guys wont like my comment as it might not be helpful however i was in your place once. I got rid of moment library all together and moved to date-fns - its much lighter and more robust. Moment was quite good in the early days but now it was getting harder to maintain with changing NG versions.

@fish3046
Copy link

Following @hassanasad's advice is indeed the correct one, as the moment team has announced they deprecated the project.

We recognize that many existing projects may continue to use Moment, but we would like to discourage Moment from being used in new projects going forward. Instead, we would like to recommend alternatives that are excellent choices for use in modern applications today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants