Witam, mam taki problem, że pakiet npm nie daje się używać w vue, a bez vue czysty js z tym pakietem w node działa. Chciałbym użyć tego pakietu https://www.npmjs.com/package/modern-rcon w vue. Standardowa implementacja nie działa
<template>
<div>
<input type="text" v-model="command" />
<button @click="test">SEND</button>
</div>
</template>
<script>
export default {
name: "rcon_client",
data(){
return{
command: "",
}
},
methods: {
async test(){
const Rcon = require('modern-rcon');
var rcon = new Rcon('localhost', 'haslo');
rcon.connect().then(() => {
return rcon.send('help'); // That's a command for Minecraft
}).then(res => {
console.log(res);
}).then(() => {
return rcon.disconnect();
})
}
}
}
</script>
<style lang="scss" scoped>
</style>
Czy ktoś wie jak poprawnie używać pakietów npm w vue?