8000 [just-omit] webpack import error · Issue #539 · angus-c/just · GitHub
[go: up one dir, main page]

Skip to content

[just-omit] webpack import error #539

Open

Description

@marcebdev

When trying to import packages I see an Uncaught TypeError: just_omit__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function error when doing `import omit from 'just-omit'

Using:
"just-omit": "^2.2.0"
"webpack": "4.41.5"
"react-scripts": "3.4.0"

Not sure what's causing the import not to work on this version of webpack, I believe it doesn't support ES6 but as far as I can tell this package doesn't need ES6 it should be fine on ES5

Activity

  1. vpckso commented on Mar 24, 2023

    @vpckso

    I have same problem, and I solved by
    import omit from 'just-omit/index.mjs'

  2. marcebdev commented on Aug 23, 2023

    @marcebdev
    Author

    I have same problem, and I solved by import omit from 'just-omit/index.mjs'

    This seems to solve that but in TS envs the issue then becomes the types aren't imported when trying to import directly from /index.mjs

    Any thoughts @angus-c?

  3. marcebdev commented on Aug 23, 2023

    @marcebdev
    Author

    I've dug a little deeper here and it seems that downgrading the just packages to a version that includes only the .js file instead of the .cjs & .mjs files solves this.

    It must be something to do with either improper exports, Jest, or somewhere in-between (maybe runtime is grabbing the func from .mjs but for some reason Jest is trying to import from .cjs or something (complaining about the default export.)

    I can say I'm seeing this with Jest@24 I'd love to test on newer versions, and imagine both newer Webpack versions & Jest versions don't have this error or it would be more widespread, but for the time being the repo in question (which I've tried out this lib with) is stuck on older versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0