melloware / coloris-npm

A lightweight and elegant JavaScript color picker.
MIT License
35 stars 9 forks source link

[Vue] init is not a function #13

Closed matty0005 closed 2 years ago

matty0005 commented 2 years ago

Hi, after importing with npm, and adding the following to the top of the vue file

import "@melloware/coloris/dist/coloris.css";
import Coloris from "@melloware/coloris";
Coloris.init();
Coloris({el: "#coloris"});

I get the following error.

Uncaught (in promise) TypeError: _melloware_coloris__WEBPACK_IMPORTED_MODULE_1___default().init is not a function

If i add the library through the CDN, it works just fine.

melloware commented 2 years ago

@blutorange Any thoughts on this?

blutorange commented 2 years ago

One question, are you using TypeScript @matty0005 ? If so, can you show your tsconfig.json?

matty0005 commented 2 years ago

No, i'm not - if it helps i'm using Vue 3 (along side laravel + inertia.js).

blutorange commented 2 years ago

Alright, so the problem is a missing return which was deleted here, probably because of a merge conflict?

https://github.com/melloware/coloris-npm/commit/f8a79af374573062676415b4773e9e2d0dabc076#diff-ead9bad4168db55a026a34e4cb1a879008aef8132feb6666d49038de3669ec8aL7

So I can fix this, but let me see if I can add a simple npm test script we can use before publishing / after merging.

melloware commented 2 years ago

@matty0005 0.8.1 is on NPM now if you want to give it a try.

matty0005 commented 2 years ago

Thanks, this now works perfectly!

melloware commented 2 years ago

Fantastic. Thanks for reporting.

melloware commented 2 years ago

@matty0005 can you update to 0.10.3 and let me know if you are getting this problem again?

matty0005 commented 2 years ago

@melloware All seems fine - I have updated to 0.10.3 and don't seem to have any immediate issues.

melloware commented 2 years ago

Thanks for letting me know!