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

Import and require not working #17

Open
Apsysikal opened this issue Apr 23, 2022 · 4 comments
Open

Import and require not working #17

Apsysikal opened this issue Apr 23, 2022 · 4 comments

Comments

@Apsysikal
Copy link

I installed it via npm and wether i import or require the module I always get errors.
I tried it via the „Try on runkit“ button on npm. It fails there aswell. Is there something I‘m missing?

@Apsysikal
Copy link
Author

I've updated the package.json in the node_modules folder to contain:

...,
"exports": {
    "require": "./dist/index.cjs",
    "import": "./dist/index.mjs"
},
...

It is now working but it seems to me that changing a file in the node_modules folder probably should not be the fix for everyone.

@meodai
Copy link
Owner

meodai commented Apr 24, 2022

hey @Apsysikal we have an issue for that: #13
I'm a bit confused how to address that. Feel free to create a pull-request if you have any idea

@meodai
Copy link
Owner

meodai commented May 18, 2022

so I did that, but

import {
  generateRandomColorRamp
} from 'fettepalette';

console.log(generateRandomColorRamp) // => undefined

at least with parcel.js

@Apsysikal
Copy link
Author

I don't work with parcel. So i can't give you any input on that. It fixed it for my use case, which is generating some hex codes from the command line with a little js file. You could leave this issue open for other people with the same problem.

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

2 participants