Open YvanJAquino opened 1 year ago
Hmm can you try window.google.script.run?
It didn't work for me. Could it be a Typescript setting?
ERROR in /Development/~/~/src/client/~/gPromise.ts 4:15-21 [tsl] ERROR in //Development/~/~/src/client/~/gPromise.ts(4,16) TS2339: Property 'google' does not exist on type 'Window & typeof globalThis'. ts-loader-default_e3b0c44298fc1c14
I've tried everything I can think of: (a) using gas-client. Either I'm using this wrong (serverFunctions) or it's not working as desired - but it does compile! (b) using google.script.run directly - It doesn't compile (c) wrapping google.script.run into a promise - also didn't work.
Try it with a fresh clone from this repo and it should work with gas-client.
If you are using typescript and don't want to use gas-client, i.e. You just by to use google.script.run, you will probably need to declare google as a global variable as it's done in the gas-client repo.
I went a different route - highly recommend checking this out, too. I'm a huge fan of this project, but it feels like I've done something the 3 times I've tried using it. Typically, after I update something or install a new package, it stops working.
Have you tried Vite with some of the plugins? I combined vite, react, clasp, and some vite plugins to generate a single page - and it worked wonderfully without the all the brittleness.
One thing I'm seeing is that the server side code is also being bundled into what appears to be an IIFE. not sure how necessary this is, but it makes the code inside of Apps Script interface much harder to manage, doesn't seem to work correctly, and forces me to copy-paste all my function definitions over.
Yes I thought vite was pretty cool but didn't think it made sense to move away from webpack here (yet). Basically it would take a lot of time to update this project and I'm not sure you would gain much. A lot of the inherent problems with GAS development would still be there.
I went a different route - highly recommend checking this out, too. I'm a huge fan of this project, but it feels like I've done something the 3 times I've tried using it. Typically, after I update something or install a new package, it stops working.
Have you tried Vite with some of the plugins? I combined vite, react, clasp, and some vite plugins to generate a single page - and it worked wonderfully without the all the brittleness.
One thing I'm seeing is that the server side code is also being bundled into what appears to be an IIFE. not sure how necessary this is, but it makes the code inside of Apps Script interface much harder to manage, doesn't seem to work correctly, and forces me to copy-paste all my function definitions over.
How do you solve the problem with svg assets and etc. with vite? Can you share the link with your boilerplate =)?
Good afternoon,
This is with regards to guidance around how to use the google.script.run API directly. Attempting to use google.script.run directly in my components causes React errors.
Is there a way I can directly use the google.script.run directly?
Regards,