You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This applies only when Tagify is imported as module (see codesandbox ↑).
What is the expected behavior?
When the script enters code where Tagify.logger is supposed to print some logs, no error should be thrown. For example, tag element doesn't exist in getSetTagData().
What is happening instead?
An error is thrown at the point where Tagify.logger is called.
What error message are you getting? ReferenceError: Tagify is not defined
The problem is that Tagify is not globally available when used as module. You would need to put the logger logic into some extra file from where it gets imported into the other files. Something like:
// ./parts/Logger.jsimport{Logger}from'./Logger';exportfunctiongetSetTagData(tagElm,data,override){if(!tagElm){Logger.warn("tag element doesn't exist",{tagElm, data})returndata}}
// ./Tagify.jsimport{Logger}from'./parts/Logger';functionTagify(input,settings){if(!input){Logger.warn('input element not found',input)}}Tagify.logger=Logger;
The text was updated successfully, but these errors were encountered:
Prerequisites
💥 Demo Page
https://codesandbox.io/p/sandbox/simple-tagify-setup-logger-error-95nc55
Explanation
This applies only when Tagify is imported as module (see codesandbox ↑).
What is the expected behavior?
When the script enters code where
Tagify.logger
is supposed to print some logs, no error should be thrown. For example,tag element doesn't exist
ingetSetTagData()
.What is happening instead?
An error is thrown at the point where
Tagify.logger
is called.What error message are you getting?
ReferenceError: Tagify is not defined
The problem is that Tagify is not globally available when used as module. You would need to put the logger logic into some extra file from where it gets imported into the other files. Something like:
The text was updated successfully, but these errors were encountered: