小编Orb*_*iox的帖子

通过 VSCode Webview API 提供 SvelteKit 应用程序

在花了数周时间并多次放弃尝试解决此问题后,才提出这个问题。

我正在开发一个 VSCode 扩展,需要使用Webview API。有一段时间,这可能是使用 Svelte,但现在 SvelteKit 已稳定发布,并且在您使用时被视为默认值npm create svelte,我的目标是使用它。将应用程序配置为静态 SPA 并关闭 SSR 并使用 后@sveltejs/adapter-static,似乎提供的服务与使用 vanilla Svelte 的服务不同。

这是svelte.config.js

import adapter from '@sveltejs/adapter-static';
import preprocess from 'svelte-preprocess';

/**
 * Consult https://github.com/sveltejs/svelte-preprocess
 * for more information about preprocessors
 *
 * @type {import('@sveltejs/kit').Config} */
export default {
  preprocess: preprocess(),
  kit: {
    adapter: adapter({ fallback: 'index.html' }),
    // ssr: false, // deprecated
    csp: {
      directives: {
        'default-src': ['none'],
        'img-src': ['{{cspSource}} https:'],
        'script-src': ['{{cspSource}}'],
        'style-src': ['{{cspSource}}'], …
Run Code Online (Sandbox Code Playgroud)

javascript visual-studio-code vscode-extensions svelte sveltekit

7
推荐指数
0
解决办法
569
查看次数