Vue-cli-plugin-electron-builder: Unable to use jsx

Created on 29 Jun 2018  路  7Comments  路  Source: nklayman/vue-cli-plugin-electron-builder

Most helpful comment

You have to add support for jsx manually. See the readme for more details. A better alternative is to use the 1.0.0 alpha version. It is almost equally stable compared to the standard release, and is much better overall. Set vue-cli-plugin-electron-builder's version to ^1.0.0-alpha.11 in your package.json. Reinstall dependencies, and run vue invoke electron-builder.

All 7 comments

You have to add support for jsx manually. See the readme for more details. A better alternative is to use the 1.0.0 alpha version. It is almost equally stable compared to the standard release, and is much better overall. Set vue-cli-plugin-electron-builder's version to ^1.0.0-alpha.11 in your package.json. Reinstall dependencies, and run vue invoke electron-builder.

Thanks, but when I run vue invoke electron-builder, it doesn't prompt me whether to use typescript. And it is generated as src/background.js and when I run yarn serve:electron it will prompt src/background.ts not found. I manually extension to ts, will prompt can not be resolved vue-cli-plugin-electron-builder/lib/createProtocol module, because it lacks the type definition.
Finally, I copied the contents of vue-cli-plugin-electron-builder/lib/createProtocol to createProtocol.ts and referenced it. The problem was solved.

I tried to manually add a type definition to test, TS passed the check, but still prompt module can not be resolved. Why is this? 馃

$ echo 'export default function(scheme: string): void;' >> node_modules/vue-cli-plugin-electron-builder/lib/createProtocol.d.ts

When the first 1.0.0 beta comes out (next release) all of the changes you had to do will be automatic. I can add the createprotocol.d.ts file if you think it is necessary, but it seems overkill as it is just a single function that isn't used outside of the generated files.

Ok, now I disable the main process TypeScript via disableMainProcessTypescript.
Maybe you can set v1-dev as the default branch first.
Thank you for your great job!

No problem, glad that you fixed it. As soon as the beta comes out it will be the default version. It will have near 100% test coverage and should be very stable.

v1.0.0-beta.1 is out, you can use that now as it includes typings for createProtocol()

Was this page helpful?
0 / 5 - 0 ratings