install peer.js in vite with Vue 3 Typescript

628 views Asked by At

I'm using Vue 3 Typescript with Vite.js I want to install library peer.js. When I try using Peer:

import Peer from 'peerjs'
const myPeer = new Peer()

then Vite return error:

ReferenceError: parcelRequire is not defined

How I can install Peer.js in Vite?

1

There are 1 answers

0
major697 On

I don't know it's correct answer, but I added:

<script>
    var parcelRequire;
</script>

in index.html file

'parcelRequire is not defined' When used with snowpack. (Github)