yairEO / tagify

🔖 lightweight, efficient Tags input component in Vanilla JS / React / Angular / Vue
https://yaireo.github.io/tagify/
Other
3.52k stars 433 forks source link

prop-type error #1339

Closed rohan-logicrays closed 5 months ago

rohan-logicrays commented 5 months ago

chunk-RYOGGBNK.js?v=73822179:19441 Uncaught SyntaxError: The requested module '/node_modules/prop-types/index.js?v=73822179' does not provide an export named 'array' (at react.tagify.jsx:13:18)

yairEO commented 5 months ago

which version of Tagify?

As stated in the README, try this:

image

rohan-logicrays commented 5 months ago
"@yaireo/tagify": "^4.21.1",

import Tags from "@yaireo/tagify/dist/react.tagify";

using it like this only dont know why getting this error
chunk-RYOGGBNK.js?v=fbc70bda:19441 Uncaught SyntaxError: The requested module '/node_modules/prop-types/index.js?v=fbc70bda' does not provide an export named 'array' (at react.tagify.jsx:13:18)
yairEO commented 5 months ago

do you have any error if you are importing like so?

import Tags from "@yaireo/tagify/react"
rohan-logicrays commented 5 months ago

Failed to resolve import "@yaireo/tagify/react" from "src/utils/Input/SelectTag/SelectTagComponent.tsx". Does the file exist?

i am getting this error when i try your way

yairEO commented 5 months ago

Are you absolutely sure you have the latest version of Tagify?

because my official Codesandbox demo here shows it works:

https://codesandbox.io/p/sandbox/tagify-react-wrapper-oempc?file=%2Fsrc%2FCrazyTags.jsx%3A12%2C1-13%2C41

Also I have a repo showing this works:

https://github.com/yairEO/tagify-react-test/blob/master/src/App.jsx#L2

rohan-logicrays commented 5 months ago

I move back to the older version "@yaireo/tagify": "^4.21.1", "@types/yaireo__tagify": "^4.18.0",

now the error is different chunk-RYOGGBNK.js?v=80573a65:9145 Uncaught DOMException: Failed to execute 'toggle' on 'DOMTokenList': The token provided ('form-control custom-class d-flex gap-2 ps-1 tag-placeholder ') contains HTML space characters

yairEO commented 5 months ago

this error does not seem to be related to Tagify. Also, I do not recommend downgrading as I constantly fix bugs and have very recently, in the past week, have fixed a few important ones.

Which bundler are you using and its version & your Node version?

kiransbaliga commented 5 months ago

I also have the smae issue. I am using Vite as bundler. and use node 21 The issue seems to be realted with VIte as the problem doesnt occur while i use storybook

yairEO commented 5 months ago

I am using Vite in my test project also, to test Tagify, and have no problems:

yairEO/tagify-react-test@master/src/App.jsx#L2

With the minimal config

lweibel commented 3 months ago

I seem to be having the same issue.

If I run your test project yairEO/tagify-react-test@master/src/App.jsx#L2 but install Tagify via npm rather than as a local dependency as you have it, I can recreate the issue.

Thanks for your help btw.

yairEO commented 3 months ago

@lweibel - are you using the latest Tagify version? How are you importing it? it matters if you are importing directly from the src folder or the dist folder

lweibel commented 3 months ago

Here are the steps I took to create the error:

mkdir test
cd test
git clone https://github.com/yairEO/tagify
cd tagify
npm i
cd ..
git clone https://github.com/yairEO/tagify-react-test
cd tagify-react-test
npm remove @yaireo/tagify
npm i @yaireo/tagify
npm run dev

This installed 4.27.0.

I tried importing it in all the ways you have mentioned here and in the documentation. Do you also get an error?

yairEO commented 3 months ago

@lweibel - have you tried what I've suggested here? https://github.com/yairEO/tagify#react

A none-minified and raw source-code Tagify React component is exported from react.tagify.jsx and you can import it as seen in the below code example. This React port will only work if your bundler can handle raw source-code in ES2015+ which is better for tree-shaking.

If you get bundling errors, import Tagify (react port) from the dist folder: @yaireo/tagify/dist/react.tagify

lweibel commented 3 months ago

Yes, you can try running it. I am using your repository.

yairEO commented 3 months ago

@lweibel - are you using npm or pnpm? it matters

lweibel commented 3 months ago

Here are the steps I took to create the error:

mkdir test
cd test
git clone https://github.com/yairEO/tagify
cd tagify
npm i
cd ..
git clone https://github.com/yairEO/tagify-react-test
cd tagify-react-test
npm remove @yaireo/tagify
npm i @yaireo/tagify
npm run dev

This installed 4.27.0.

I tried importing it in all the ways you have mentioned here and in the documentation. Do you also get an error?

npm