GithubHelp home page GithubHelp logo

Comments (4)

baer avatar baer commented on May 18, 2024 1

It looks like this is a Typescript issue and it's a problem for lots of libs. A quick search turned up the following:

auth0/auth0-spa-js#99
omrilotan/isbot#41
molnarg/js-schema#49
middyjs/middy#203
iamkun/dayjs#475

I'm importing this lib from a non-typescript codebase. I don't know enough TS to debug this but, from what I can gather, it's something to do with how the module system does interop with and will ultimately be resolved through fiddling with the allowSyntheticDefaultImports and esModuleInterop flags.

You can see some of the TS module system discussions from way back at 1.5 and a pretty steady stream of issues around ES6 interop like this one in the TS codebase.

from date-fns-upgrade.

baer avatar baer commented on May 18, 2024

Sorry, I should add stacktrace to this to make the report a bit more helpful. It's not clear to me from this whether the problem is my project's ES6 import of date-fns-upgrade or if it's a Typescript interop issue between date-fns-upgrade and date-fns

My projectis a Next.js 9 (the latest) project using JavaScript (not Typescript) that compiles using babel-preset-env for the latest 3 Chrome versions. I've tried the following import formats out of curiosity and they all emit the same error:

import { legacyParse } from '@date-fns/upgrade/v2';

import * as datefnsUpgrade from '@date-fns/upgrade/v2';
const { legacyParse } = datefnsUpgrade

const { legacyParse } = require('@date-fns/upgrade/v2');

const datefnsUpgrade = require('@date-fns/upgrade/v2');
const { legacyParse } = datefnsUpgrade
TypeError: isDate_1.default is not a function
    at legacyParse (<project_path>/node_modules/@date-fns/upgrade/v2/legacyParse/index.js:38:23)
    at <project_path>/.next/server/static/development/pages/_app.js:2706:71
    at index (<project_path>/.next/server/static/development/pages/_app.js:2784:173)
    at A (<project_path>/node_modules/lodash/lodash.min.js:9:54)
    at An.times (<project_path>/node_modules/lodash/lodash.min.js:124:472)
    at l (<project_path>/node_modules/lodash/lodash.min.js:50:137)
    at <project_path>/node_modules/lodash/lodash.min.js:49:114
    at generateLines (<project_path>/.next/server/static/development/pages/_app.js:2785:147)
    at Module../src/redux/modules/order/index.js (<project_path>/.next/server/static/development/pages/_app.js:2802:20)
    at __webpack_require__ (<project_path>/.next/server/static/development/pages/_app.js:23:31)
    at Module../src/redux/reducers.js (<project_path>/.next/server/static/development/pages/_app.js:3310:73)
    at __webpack_require__ (<project_path>/.next/server/static/development/pages/_app.js:23:31)
    at Module../src/redux/create-store.js (<project_path>/.next/server/static/development/pages/_app.js:1009:67)
    at __webpack_require__ (<project_path>/.next/server/static/development/pages/_app.js:23:31)
    at Module../pages/_app.js (<project_path>/.next/server/static/development/pages/_app.js:885:81)
    at __webpack_require__ (<project_path>/.next/server/static/development/pages/_app.js:23:31)

from date-fns-upgrade.

dkozickis avatar dkozickis commented on May 18, 2024

Hi! Thank you for reporting this.
We've published [email protected] that should solve this issue without using interop.
Let us know if you still have problems.

from date-fns-upgrade.

NJXZhang avatar NJXZhang commented on May 18, 2024

Thank you so much for the quick fix. It is working now.

from date-fns-upgrade.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.