-# sv
+# SvelteKit Legacy Template
-Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
+This project is a SvelteKit template configured for legacy browser support (IE11) using `@vitejs/plugin-legacy`.
-## Creating a project
+## Setup
-If you're seeing this, you've probably already done this step. Congrats!
-
-```sh
-# create a new project in the current directory
-npx sv create
-
-# create a new project in my-app
-npx sv create my-app
-```
+1. Install dependencies:
+ ```bash
+ npm install
+ # or
+ pnpm install
+ ```
## Developing
-Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
+Start the development server:
-```sh
+```bash
npm run dev
-
-# or start the server and open the app in a new browser tab
-npm run dev -- --open
```
-## Building
+*Note: The development server uses Vite's modern ESM serving and does NOT emulate legacy browsers. To test legacy support, you must build and preview.*
+
+## Building (Legacy Support)
-To create a production version of your app:
+To generate the production build, which includes both modern chunks and legacy chunks (transpiled for IE11):
-```sh
+```bash
npm run build
```
-You can preview the production build with `npm run preview`.
+This command will:
+1. Build the server-side code.
+2. Build the client-side code (Modern).
+3. Generate potential legacy chunks and polyfills via `@vitejs/plugin-legacy`.
+
+You will see output indicating `legacy` chunks are being generated.
+
+## Serving / Previewing
+
+To serve the built application (production mode) and verify legacy loading:
+
+```bash
+npm run preview
+```
-> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
+Open the exposed URL (e.g., `http://localhost:4173`) in your legacy browser (e.g., IE11 virtual machine) to verify it loads correctly.
{
- "name": "website-template-svkit-v2-legacy",
- "private": true,
+ "name": "@tg-svelte/website-template-svkit-v2-legacy",
"version": "0.0.1",
"type": "module",
+ "description": "SvelteKit v2 website sample/template with IE11 legacy support configuration.",
+ "private": true,
"author": "Shane Jaroch <chown_tee@proton.me>",
"contributors": [
"Tal Hadad <tal_hd@hotmail.com>"
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
- "prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
},
"devDependencies": {
- "@sveltejs/adapter-auto": "^7.0.0",
- "@sveltejs/kit": "^2.49.1",
- "@sveltejs/vite-plugin-svelte": "^6.2.1",
- "svelte": "^5.45.6",
- "svelte-check": "^4.3.4",
- "typescript": "^5.9.3",
- "vite": "^7.2.6"
+ "@sveltejs/adapter-auto": "^3.0.0",
+ "@sveltejs/kit": "npm:@tg-svelte/kit@^2.49.4",
+ "@sveltejs/vite-plugin-svelte": "^3.0.0",
+ "@vitejs/plugin-legacy": "^5.0.0",
+ "svelte": "^5.0.0-next.1",
+ "svelte-check": "^3.6.0",
+ "terser": "^5.0.0",
+ "vite": "^5.0.0"
+ },
+ "overrides": {
+ "@sveltejs/kit": "file:../../packages/kit"
+ },
+ "pnpm": {
+ "overrides": {
+ "@sveltejs/kit": "file:../../packages/kit"
+ }
}
}
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
+import legacy from '@vitejs/plugin-legacy';
export default defineConfig({
- plugins: [sveltekit()]
+ plugins: [
+ legacy({
+ targets: ['ie 11']
+ }),
+ sveltekit()
+ ]
});