Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get an empty object when using ES6 import #15

Open
ndabAP opened this issue Jun 23, 2019 · 12 comments
Open

Get an empty object when using ES6 import #15

ndabAP opened this issue Jun 23, 2019 · 12 comments

Comments

@ndabAP
Copy link

ndabAP commented Jun 23, 2019

Maybe I miss something but when I do:

import workly from 'workly'

the workly object is empty.

@pshihn
Copy link
Owner

pshihn commented Jun 23, 2019

workly is essentially two functions expose and proxy, so depending on which ones you want to use you import those.

import {proxy, expose} from 'workly'

I should update the docs with this

@ndabAP
Copy link
Author

ndabAP commented Jun 23, 2019

Thanks for your feedback. Also tried that and it gave me undefined.

@pshihn
Copy link
Owner

pshihn commented Jun 23, 2019

Ok i'll take a look later today. Probably something I overlooked.

@ndabAP
Copy link
Author

ndabAP commented Jun 24, 2019

Thanks :) Using Webpack (actually Vue.js but it uses Webpack).

@pshihn
Copy link
Owner

pshihn commented Aug 17, 2019

I'm so sorry. I never got back to you on this.
Please let me know if you're still using workly

@ndabAP
Copy link
Author

ndabAP commented Aug 23, 2019

Actually no, but the problem is likely not gone ;)

@pshihn
Copy link
Owner

pshihn commented Aug 23, 2019

Thanks. It has something to do with es6 modules in a Webpack that is not configured for that. I have not used web pack much but will try setting up a Vue project with it

@colshacol
Copy link

I am experiencing this, currently.

I created a CodeSandbox to demonstrate the issue. :)

https://codesandbox.io/s/awesome-stonebraker-19e9w

@AnonymousArthur
Copy link

Same issue here, getting empty object when doing import * as workly from "workly".
Also tried

import { proxy, expose } from 'workly';
[ERROR] Cannot find name 'proxy'. Did you mean 'Proxy'?
Cannot find name 'expose'.

Checked source code and generated d.ts file, both proxy and expose are exported. Any idea why this is happening?

@AnonymousArthur
Copy link

AnonymousArthur commented Nov 8, 2019

UPDATE:
fixed by import * as workly from 'workly/dist/workly.m.js';
Which isn't that intuitive.

@ndabAP
Copy link
Author

ndabAP commented Nov 8, 2019

fixed by import * as workly from 'workly/dist/workly.m.js';

That's a work around.

@kairos666
Copy link

I was using workerize but came to workly because of the clean and simple interface.
Unfortunately ES6 import unreliable support was a deal breaker for my use case.

Will check again though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants