Closed sxshateri closed 3 years ago
did you install Tagify? what version are you using? Please add a demo page for me to examine. There was a link it when you opened this issue. without this i cannot help:
React issue template: https://codesandbox.io/s/tagify-react-issue-template-4ub1r?file=/src/index.js
clone it, change it, and post here the link please
did you install Tagify? what version are you using? Please add a demo page for me to examine. There was a link it when you opened this issue. without this i cannot help:
React issue template: https://codesandbox.io/s/tagify-react-issue-template-4ub1r?file=/src/index.js
clone it, change it, and post here the link please
yes i installed Tagify using NPM. and it was the latest version available. I'm not sure how to recreate the issue since its an entire Laravel project and I'm not able to share it for security reasons.
The message:
'Tagify' is declared but its value is never read
You can safely ignore this or simply write new Tagify
instead of tagify = new Tagify
without creating a variable for it.
I don't know how can Tagify
is not defined if you imported it after installing.
did you import Tagify
in the file?
i imported it using import Tagify from '@yaireo/tagify';
in my JS bundle file then used the following sample in my actual webpage:
<script>
var input = document.querySelector('textarea[name=webskills]'),
tagify = new Tagify(input, {
enforceWhitelist : true,
delimiters : null,
whitelist : ["The Shawshank Redemption", "The Godfather", "The Godfather: Part II", "The Dark Knight", "12 Angry Men", "Schindler's List", "Pulp Fiction",],
callbacks : {
add : console.log, // callback when adding a tag
remove : console.log // callback when removing a tag
}
});
</script>
but its not working. i get the Uncaught ReferenceError: Tagify is not defined
in the console and the 'Tagify' is declared but its value is never read
in my bundle file.
is there anything else that missed?
Which bundler are you using? Webpack? Parcel? Rollup?
I'm using Laravel Mix which is technically the same as Webpack but just simpler. It uses Webpack in the background.
is this any help?
module "c:/laragon/www/codersCast/node_modules/@yaireo/tagify/dist/tagify.min"
'Tagify' is declared but its value is never read.ts(6133)
Could not find a declaration file for module '@yaireo/tagify'. 'c:/laragon/www/codersCast/node_modules/@yaireo/tagify/dist/tagify.min.js' implicitly has an 'any' type.
Try `npm install @types/yaireo__tagify` if it exists or add a new declaration (.d.ts) file containing `declare module '@yaireo/tagify';`ts(7016)
I have no idea, you need to re-create a simplified version in codesandbox.io so I could examine.
Tagify is working fine, perhaps there is something special in Laravel which you need to configure in order to import things from node_modules
folder.
As you can see, importing & using tagify works as expected: https://codesandbox.io/s/simple-tagify-setup-6pfi2?file=/src/index.js
@sxshateri if you are using laravel mix, in app.js try adding like this :
const Tagify = window.Tagify = require('@yaireo/tagify');
this should work.
Also having the same issue in Laravel 9 which uses Vite instead of mix.
Tagify is being successfully imported, is included in the page, but
var inputElement = document.querySelector('input')
new Tagify(inputElement)
results in:
bulk:28 Uncaught ReferenceError: Tagify is not defined
Tagify is being successfully imported
But your error says: "Tagify is not defined"
This means it isn't imported properly. Check carefully if it is really being imported.
Well it is, but Vite breaks it when using nom run build
. Unfortunately not been able to figure out why this is happening. I created a stackoverflow post about it with code examples here:
https://stackoverflow.com/questions/74786903/laravel-9-with-vite-breaks-a-js-file-on-npm-run-build
So far no answers, I will try to speak to vite/laracasts to see what they think it happening.
im trying to use Tagify in my project but either the document is not clear about how to use it or im the worst person in terms of JS. i added the
import Tagify from '@yaireo/tagify';
in myapp.js
and compiled it with no error but then i returned to theapp.js
i got the IDE warning of'Tagify' is declared but its value is never read
and i have no idea what should i do about this. also in the console i get theUncaught ReferenceError: Tagify is not defined error
.also im using the following script in my blade file to use the tagify on a textbox: