Move to Svelte 5 and Vite

This commit is contained in:
Leon Grünewald 2024-09-02 02:37:25 +02:00
parent 2a3c3c022d
commit a8e1b2dfa1
7 changed files with 215 additions and 2985 deletions

33
jsconfig.json Normal file
View file

@ -0,0 +1,33 @@
{
"compilerOptions": {
"moduleResolution": "bundler",
"target": "ESNext",
"module": "ESNext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
* `import type` instead of `import` for Types.
*/
"verbatimModuleSyntax": true,
"isolatedModules": true,
"resolveJsonModule": true,
/**
* To have warnings / errors of the Svelte compiler at the
* correct position, enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable this if you'd like to use dynamic types.
*/
"checkJs": true
},
/**
* Use global.d.ts instead of compilerOptions.types
* to avoid limiting type declarations.
*/
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}

View file

@ -3,27 +3,18 @@
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "farm", "dev": "vite",
"start": "farm", "build": "vite build",
"build": "farm build", "preview": "vite preview",
"preview": "farm preview",
"clean": "farm clean",
"check": "svelte-check --tsconfig ./tsconfig.json",
"deploy": "wrangler deploy", "deploy": "wrangler deploy",
"wrangler-dev": "wrangler dev", "wrangler-dev": "wrangler dev",
"wrangler-start": "wrangler dev" "wrangler-start": "wrangler dev"
}, },
"devDependencies": { "devDependencies": {
"@cloudflare/kv-asset-handler": "^0.3.4", "@cloudflare/kv-asset-handler": "^0.3.4",
"@farmfe/cli": "^1.0.2", "@sveltejs/vite-plugin-svelte": "4.0.0-next.6",
"@farmfe/core": "^1.3.0", "svelte": "5.0.0-next.242",
"@sveltejs/vite-plugin-svelte": "^3.0.2", "vite": "^5.4.2",
"@tsconfig/svelte": "^5.0.4",
"core-js": "^3.36.1",
"svelte": "^4.2.12",
"svelte-check": "^3.6.8",
"tslib": "^2.6.2",
"typescript": "^5.4.3",
"wrangler": "^3.67.1" "wrangler": "^3.67.1"
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,8 @@
import App from "./App.svelte"; import { mount } from 'svelte';
import App from './App.svelte';
const app = new App({ const app = mount(App, {
target: document.getElementById("app"), target: document.getElementById('app'),
}); });
export default app; export default app;

View file

@ -1,20 +0,0 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"resolveJsonModule": true,
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable checkJs if you'd like to use dynamic types in JS.
* Note that setting allowJs false does not prevent the use
* of JS in `.svelte` files.
*/
"allowJs": true,
"checkJs": true,
"isolatedModules": true
},
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View file

@ -1,11 +0,0 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["farm.config.ts"]
}

View file

@ -1,6 +1,8 @@
import { defineConfig } from '@farmfe/core'; import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte'; import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({ export default defineConfig({
vitePlugins: [svelte()] plugins: [
svelte({})
]
}); });