Setting up VSCode for debugging to mimic the auto-include functionality of GAS space

83 views
Skip to first unread message

Guy Gummy

unread,
Oct 3, 2021, 1:40:35 PM10/3/21
to google-apps-sc...@googlegroups.com
So I've got this:

gas-editor.png

Which will not compile. So using clasp, since I have not yet figured out how to configure VSCode to treat all js files in a directory as if they were the same file (of same namespace) even with a jsconfig.json file, I've just been resorting to concatenating all the files before every push. However, besides not looking as impressive (say, while presenting a proposal to do this fulltime for the company I work at) as having distinct file names representing the namespace domain, this is kind of a pain when debugging locally.

I am just curious if anyone has figured out the best way to handle this.

Thanks!

Clark Lind

unread,
Oct 4, 2021, 11:34:09 AM10/4/21
to Google Apps Script Community
If doing this in vanilla JS (versus a framework like Svelte, Vue, React, etc), then you should probably mimic what those frameworks do and have a "main" entrypoint file (main.js, app.js, etc), and just "import" all your other JS files into it. 
Ashton Fei uses Vue in this example, (code) but the concept is the same. It is basically a one-way process: 1) develop in VSCode, 2) Compile for GAS usage, 3) Push to GAS using Clasp.  He has a nice utility script that renames everything appropriately.

I was thinking of writing a utility that would properly setup the local workspace for working with Clasp Clones/Pulls, but haven't gotten around to it. Once I push to GAS, I usually fine-tune everything there in the IDE.

Reply all
Reply to author
Forward
0 new messages