首页 > 解决方案 > 苗条:应用程序/ld+json

问题描述

使用以下代码:

<svelte:head>
    <script type='application/ld+json'>
    {
    "@context": "https://schema.org",
    "@type": "Organization",
    "url": "https://filestar.com",
    "logo": "https://filestar.com/logo-512.png"
    }
    </script>
</svelte:head>

在得到:

[svelte-preprocess] Error transforming 'ld+json'.

Message:
Cannot find module './transformers/ld+json'

Stack:
Error: Cannot find module './transformers/ld+json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Promise.resolve.then (C:\Repos\Filestar-Website\web-vnext\node_modules\svelte-preprocess\dist\utils.js:112:61)

我已经尝试了这个 github 线程中的建议,结果相同:https ://github.com/sveltejs/svelte/issues/2438

标签: sveltesappersvelte-3

解决方案


看起来这与svelte-preprocess相关。尝试添加preserve: ['ld+json'] 选项


推荐阅读