Local development (sideloading)
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:
- In your extension’s directory, run
npm run serveto run the Parcel dev server. Wait until it reports that it’s listening.
- In the Ext ▲ debug menu, click Sideload Extension -> Load Extension.
- Enter the URL the Parcel dev server is listening on.
- Your extension should appear in the debug menu’s “active extensions” list. If it doesn’t, there may have been an error when activating your extension - check the debug console for error messages.
After doing this, the development cycle is as follows:
- Make a change to your extension’s code, then save the file.
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:
lnfs-clias dependencies (
npm install --save-dev mkdirp lnfs-cli).
Add the following npm script to your
"symlink-package": "mkdirp dist && lnfs ./package.json ./dist/package.json"
servenpm script to run
"serve": "npm run symlink-package && parcel serve --no-hmr --out-file dist/your-extension.js src/your-extension.ts"