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

Error when importing into a electron-vue app #11

Open
devszr opened this issue Mar 17, 2018 · 6 comments
Open

Error when importing into a electron-vue app #11

devszr opened this issue Mar 17, 2018 · 6 comments

Comments

@devszr
Copy link

devszr commented Mar 17, 2018

Hi,

I'm trying to use VueWorker in an app created with electron-vue, [https://github.com/SimulatedGREG/electron-vue].

When importing VueWorker, I get the following error,
Uncaught SyntaxError: Unexpected token import at createScript (vm.js:74) at Object.runInThisContext (vm.js:116) at Module._compile (module.js:533) at Object.Module._extensions..js (module.js:580) at Module.load (module.js:503) at tryModuleLoad (module.js:466) at Function.Module._load (module.js:458) at Module.require (module.js:513) at require (internal/module.js:11) at eval (external "vue-worker"?b6d5:1)

I don't know if this is a problem with electron-vue or with VueWorker, thought I'll ask here first.
The error is reported in \node_modules\vue-worker\index.js:1.

Steps:

Create an empty project with vue init simulatedgreg/electron-vue my-project

Then npm install vue-worker and import it in the main.js created by electron-vue.

As soon as you start the application, you'll see the error.

Any ideas ?

Thanks.

I posted an issue on electron-vue as well, SimulatedGREG/electron-vue/issues/562

@mistricky
Copy link

@devszr Have you solved the problem? I have a same problem.

@devszr
Copy link
Author

devszr commented Dec 24, 2018

@haodawang Nope. I ended up not using vue-worker.

@somidad
Copy link

somidad commented Dec 28, 2018

@devszr Did you find an alternative?

@devszr
Copy link
Author

devszr commented Dec 28, 2018

@gsongsong Not really. I used Node's child_process module directly without using webworkers since my use case was within an Electron App.

@somidad
Copy link

somidad commented Dec 28, 2018

@devszr Sad. I adopted suggestion described in https://stackoverflow.com/a/40251412/3278063.

A worker window is hidden ({show: false}) and routed to #/worker, which renders page with just an empty template and <script></script>, the real part.

I am not sure this approach has limitations, but so far it looks goot to me. Bothersome part is on main process bridging two (or more) renderer processes.

@SpotlightPL
Copy link

@devszr you can simply whitelist vue-worker inside rendered config.
SimulatedGREG/electron-vue#284

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

4 participants