Villain
Villain copied to clipboard
can't convert undefined to object
An error occurs when I'm trying to run the script
Both worker-bundle.js and archive are in a public folder, but for some reason I'm getting this error:
Has anyone encountered this problem before? How to fix it?
My code:
import React from "react";
import Villain from 'villain-react';
import 'villain-react/dist/style.css';
function App() {
const url = 'example.zip';
const workerUrl = 'worker-bundle.js';
return <Villain
workerUrl={workerUrl}
source={url}
/>
}
export default App;
I think you need to use the full url for workerUrl
Example: http://localhost:3000/worker-bundle.js
See: https://github.com/btzr-io/Villain/issues/739#issuecomment-736117432
Unfortunately it doesn't help. I've been trying to fix this for a few hours already, but can't find where the problem is coming from. The error above is the only one i get, i don't have any errors related to worker-bundle file or archive itself. Maybe there is a conflict in my dependencies, I'm not really sure.
Can you provide a reproducible example ? https://codesandbox.io/ or a github repository
I have a feeling that solution is pretty obvious. https://codesandbox.io/s/falling-surf-9ur1h?file=/src/App.js
This issue was resolved on the new version. I'll try to publish the new vesion in a few days / weeks.