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

Using yarn instead of npm occurs error in importing module #88

Open
mgmgpyaesonewin opened this issue Jan 16, 2018 · 3 comments
Open

Using yarn instead of npm occurs error in importing module #88

mgmgpyaesonewin opened this issue Jan 16, 2018 · 3 comments

Comments

@mgmgpyaesonewin
Copy link

TypeError: __WEBPACK_IMPORTED_MODULE_7_moment___default(...)(...).recur is not a function


 recurrence = moment().recur({
          start: this.broadcastData.fromDate,
        }).every(this.broadcastData.repeatQuantity).day();
        let nextDates = recurrence.next(this.broadcastData.repeatQuantity, 'L');

moment().recur cannot import directly.

@schoening
Copy link

I have the same problem using yarn add moment-recur and using it by
import "moment-recur"

The issue is solved by npm install moment-recur but thats hacky..

I am using TypeScript by the way, have to use //@ts-ignore however and I dont think the TypeScript part is the issue here.

@jefbarn
Copy link

jefbarn commented Apr 8, 2018

With moment plugins it is important that all the plugins are using the same version of moment.
Check this using yarn list moment

If it is resolving to multiple copies of moment, you can fix this by limiting your max version in your dependencies, or adding a 'resolutions' to your package.json

  "resolutions": {
    "**/moment": "2.21.0"
  },

@toninofox
Copy link

I have synchronized my versions of moment to the same one and this solved the issue. Thanks @jefbarn!

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

4 participants