Search code examples
visual-studio-codesveltevscode-extensionsvscode-api

vscode extension development: svelte content not loading in webview after building the vscode extension


I am building a vscode extension by using svelte for webview. I am following https://youtu.be/a5DX5pQ9p5M. But the deployment of extension is not mentioned in the tutorial .

So i am following https://code.visualstudio.com/api/working-with-extensions/publishing-extension.

So after packaging the extension with vsce package and installing the extension the extension doesn't load svelte content but when running in developer mode everything works fine.

I tried creating the package extension multiple Times but still didn't work.


Solution

  • Check if all necessarily files are included via:

    vsce ls
    

    (You can also open packaged extensions, they are just ZIP-archives with a different extension.)

    If they are not (e.g. src is excluded by default), you probably can create a .vscodeignore file and manually specify what to exclude.

    Running extension problems can be inspected via Help > Toggle Developer Tools, usually you will find some errors in the console.

    I do not know if debugging forces the extension to load, but if so, make sure you have set the correct activationEvents.