From 944516be8e3ae1a630f754341b2b949c6723d10d Mon Sep 17 00:00:00 2001 From: Dylan Hildenbrand Date: Wed, 6 Jul 2022 15:09:28 -0500 Subject: [PATCH] with https://github.com/sveltejs/kit/issues/5184, svelte-kit dev is no longer valid and all vite config options have been moved to vite.config.js --- package-lock.json | 13 +++---------- package.json | 11 ++++++----- svelte.config.js | 23 +---------------------- vite.config.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 37 deletions(-) create mode 100644 vite.config.js diff --git a/package-lock.json b/package-lock.json index c40fea1..2da2fee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "prettier": "^2.5.1", "prettier-plugin-svelte": "^2.5.0", "svelte": "^3.44.0", + "vite": "^2.9.13", "vite-plugin-pwa": "^0.12.2" } }, @@ -4683,7 +4684,6 @@ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", "dev": true, - "peer": true, "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -4922,7 +4922,6 @@ "url": "https://tidelift.com/funding/github/npm/postcss" } ], - "peer": true, "dependencies": { "nanoid": "^3.3.4", "picocolors": "^1.0.0", @@ -5437,7 +5436,6 @@ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "dev": true, - "peer": true, "engines": { "node": ">=0.10.0" } @@ -5985,7 +5983,6 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.13.tgz", "integrity": "sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==", "dev": true, - "peer": true, "dependencies": { "esbuild": "^0.14.27", "postcss": "^8.4.13", @@ -9715,8 +9712,7 @@ "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "dev": true, - "peer": true + "dev": true }, "natural-compare": { "version": "1.4.0", @@ -9875,7 +9871,6 @@ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", "dev": true, - "peer": true, "requires": { "nanoid": "^3.3.4", "picocolors": "^1.0.0", @@ -10258,8 +10253,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true, - "peer": true + "dev": true }, "source-map-support": { "version": "0.5.21", @@ -10647,7 +10641,6 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.13.tgz", "integrity": "sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==", "dev": true, - "peer": true, "requires": { "esbuild": "^0.14.27", "fsevents": "~2.3.2", diff --git a/package.json b/package.json index 48a18e3..4d637be 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,11 @@ "name": "helth", "version": "0.0.1", "scripts": { - "dev": "svelte-kit dev --https", - "build": "svelte-kit build", - "package": "svelte-kit package", - "preview": "svelte-kit preview", - "prepare": "svelte-kit sync", + "dev": "vite dev --https", + "build": "vite build", + "package": "vite package", + "preview": "vite preview", + "prepare": "vite sync", "test": "playwright test", "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .", "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ." @@ -21,6 +21,7 @@ "prettier": "^2.5.1", "prettier-plugin-svelte": "^2.5.0", "svelte": "^3.44.0", + "vite": "^2.9.13", "vite-plugin-pwa": "^0.12.2" }, "type": "module", diff --git a/svelte.config.js b/svelte.config.js index 2303d67..7cb42ee 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,6 +1,4 @@ import adapter from '@sveltejs/adapter-node'; -import path from 'path'; -import { VitePWA } from 'vite-plugin-pwa'; /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -11,26 +9,7 @@ const config = { prerender: { default: true }, - trailingSlash: 'always', - vite: { - plugins: [ - VitePWA({ registerType: 'autoUpdate'}) - ], - server: { - fs: { - allow: ['static'] - } - }, - resolve: { - alias: { - // set an alias so images can be dynamically imported - $static: path.resolve('./static'), - $components: path.resolve('./src/components'), - $utils: path.resolve('./src/utils'), - $stores: path.resolve('./src/stores') - } - } - } + trailingSlash: 'always' } }; diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..cc2aef9 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,29 @@ +// vite.config.js +import { sveltekit } from '@sveltejs/kit/vite'; +import path from 'path'; +import { VitePWA } from 'vite-plugin-pwa'; + + +/** @type {import('vite').UserConfig} */ +const config = { + plugins: [ + sveltekit(), + VitePWA({ registerType: 'autoUpdate'}) + ], + server: { + fs: { + allow: ['static'] + } + }, + resolve: { + alias: { + // set an alias so images can be dynamically imported + $static: path.resolve('./static'), + $components: path.resolve('./src/components'), + $utils: path.resolve('./src/utils'), + $stores: path.resolve('./src/stores') + } + } +}; + +export default config;