When developing an extension, you can sideload it from your local development machine's Parcel dev server (instead of re-publishing it after each code change). This speeds up the development cycle and avoids breaking the published version of your extension. This works on Sourcegraph.com and self-hosted instances.
To set this up:
npm run serve
to run the Parcel dev server. Wait until it reports that it's listening.localStorage.debug=true;location.reload()
.After doing this, the development cycle is as follows:
When you're done, clear the sideload URL from the extensions debug menu.
Note: This workflow assumes that, when running the Parcel dev server, a symlink exists in the dist/
directory pointing to your package.json
. If you created your extension the easy way, this is already set up for you. Otherwise, follow these steps:
Add mkdirp
and lnfs-cli
as dependencies (npm install --save-dev mkdirp lnfs-cli
).
Add the following npm script to your package.json
:
"symlink-package": "mkdirp dist && lnfs ./package.json ./dist/package.json"
Edit the serve
npm script to run symlink-package
:
"serve": "npm run symlink-package && parcel serve --no-hmr --out-file dist/your-extension.js src/your-extension.ts"