<script lang="ts">
import { dereference } from "@apidevtools/json-schema-ref-parser";
</script>
svelte.config.js
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
},
};
export default config;
vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';
import path from 'path';
const config: UserConfig = {
plugins: [sveltekit()]
};
export default config;
output from vite dev
X [ERROR] Could not resolve "node-fetch"
node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js:140:113:
140 │ const { default: fetch, Request, Headers } = yield Promise.resolve().then(() => __importStar(require("node-fetch")));
╵ ~~~~~~~~~~~~
You can mark the path "node-fetch" as external to exclude it from the bundle, which will remove
this error. You can also surround this "require" call with a try/catch block to handle this
failure at run-time instead of bundle-time.
12:12:43 pm [vite] error while updating dependencies:
Error: Build failed with 1 error:
node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js:140:113: ERROR: Could not resolve "node-fetch"
at failureErrorWithLog (C:\Users\user\svelte-schema-form\node_modules\esbuild\lib\main.js:1604:15)
at C:\Users\user\svelte-schema-form\node_modules\esbuild\lib\main.js:1056:28
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
routes/+page.svelte
svelte.config.js
vite.config.ts
output from
vite dev