Villain icon indicating copy to clipboard operation
Villain copied to clipboard

can't convert undefined to object

Open reklast opened this issue 2 years ago • 5 comments

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:

image

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;

reklast avatar Oct 22 '21 18:10 reklast

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

btzr-io avatar Oct 22 '21 21:10 btzr-io

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.

reklast avatar Oct 23 '21 00:10 reklast

Can you provide a reproducible example ? https://codesandbox.io/ or a github repository

btzr-io avatar Oct 23 '21 01:10 btzr-io

I have a feeling that solution is pretty obvious. https://codesandbox.io/s/falling-surf-9ur1h?file=/src/App.js

reklast avatar Oct 23 '21 02:10 reklast

This issue was resolved on the new version. I'll try to publish the new vesion in a few days / weeks.

btzr-io avatar Aug 19 '22 21:08 btzr-io