Below is the set of external javascript functions that I'm calling from a vue instance
// debounce
function debounce(func, wait, immediate) {
let timeout;
return function() {
let context = this, args = arguments;
later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
let callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
// -- end debounce
// animate css
function animateCss(element, animationName, callback) {
const node = document.querySelector(element)
node.classList.add('animated', animationName)
function handleAnimationEnd() {
node.classList.remove('animated', animationName)
node.removeEventListener('animationend', handleAnimationEnd)
if (typeof callback === 'function') callback()
}
node.addEventListener('animationend', handleAnimationEnd);
}
// -- end animate css
and my vue instance
new Vue({
el: '#app',
template: '#search-tpl',
methods: {
onKeyDown: debounce(function(){
animateCss('#searchboxui-wrapper', 'fadeOutDown',function(){
document.querySelector('#searchboxui-wrapper').style.display = 'none';
});
}
}
})
but it always throws me undefined, even if I declare the axios package or socketio package, it throws me undefined, any help, ideas please?
PS: I'm using Vue CLI 3

Search.vue?importwhatever external libraries each component is using, so webpack knows to include them). Can you show the code where you're currently trying to "declare the axios package"?exportthe functions? @niklaz's answer below shows exactly how this should work. If that doesn't seem to fix it, please show the import / export code in the question, it's hard to debug based on a description.