summaryrefslogtreecommitdiff
path: root/packages/integrations/svelte
diff options
context:
space:
mode:
authorGravatar Bjorn Lu <bjornlu.dev@gmail.com> 2023-01-04 02:24:49 +0800
committerGravatar GitHub <noreply@github.com> 2023-01-03 13:24:49 -0500
commitf6cf92b48317a19a3840ad781b77d6d3cae143bb (patch)
treec22d07726672c36ba35a69285c1ad98e8d62e28c /packages/integrations/svelte
parent5007bc78815ce81e91c9b1482c1b84e1214de4b0 (diff)
downloadastro-f6cf92b48317a19a3840ad781b77d6d3cae143bb.tar.gz
astro-f6cf92b48317a19a3840ad781b77d6d3cae143bb.tar.zst
astro-f6cf92b48317a19a3840ad781b77d6d3cae143bb.zip
Upgrade to Vite 4 (#5685)
* Upgrade Vite 4 * Simplify Svelte preprocess setup * Upgrade rollup * Fix tests * Fix wrong changeset target * Fix error tests * Set NODE_ENV default
Diffstat (limited to 'packages/integrations/svelte')
-rw-r--r--packages/integrations/svelte/package.json10
-rw-r--r--packages/integrations/svelte/src/index.ts28
2 files changed, 10 insertions, 28 deletions
diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json
index a4ad25e54..fdde735ef 100644
--- a/packages/integrations/svelte/package.json
+++ b/packages/integrations/svelte/package.json
@@ -33,19 +33,17 @@
"dev": "astro-scripts dev \"src/**/*.ts\""
},
"dependencies": {
- "@sveltejs/vite-plugin-svelte": "^1.0.1",
- "postcss-load-config": "^3.1.4",
- "svelte-preprocess": "^4.10.7",
+ "@sveltejs/vite-plugin-svelte": "^2.0.2",
"svelte2tsx": "^0.5.11"
},
"devDependencies": {
"astro": "workspace:*",
"astro-scripts": "workspace:*",
- "svelte": "^3.48.0",
- "vite": "^3.0.0"
+ "svelte": "^3.54.0",
+ "vite": "^4.0.3"
},
"peerDependencies": {
- "svelte": "^3.46.4"
+ "svelte": "^3.54.0"
},
"engines": {
"node": "^14.18.0 || >=16.12.0"
diff --git a/packages/integrations/svelte/src/index.ts b/packages/integrations/svelte/src/index.ts
index f162437c0..6bf5bcc4e 100644
--- a/packages/integrations/svelte/src/index.ts
+++ b/packages/integrations/svelte/src/index.ts
@@ -1,7 +1,6 @@
import type { Options } from '@sveltejs/vite-plugin-svelte';
-import { svelte } from '@sveltejs/vite-plugin-svelte';
-import type { AstroConfig, AstroIntegration, AstroRenderer } from 'astro';
-import preprocess from 'svelte-preprocess';
+import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte';
+import type { AstroIntegration, AstroRenderer } from 'astro';
import type { UserConfig } from 'vite';
function getRenderer(): AstroRenderer {
@@ -15,27 +14,13 @@ function getRenderer(): AstroRenderer {
type ViteConfigurationArgs = {
isDev: boolean;
options?: Options | OptionsCallback;
- postcssConfig: AstroConfig['style']['postcss'];
};
-function getViteConfiguration({
- options,
- postcssConfig,
- isDev,
-}: ViteConfigurationArgs): UserConfig {
+function getViteConfiguration({ options, isDev }: ViteConfigurationArgs): UserConfig {
const defaultOptions: Partial<Options> = {
emitCss: true,
compilerOptions: { dev: isDev, hydratable: true },
- preprocess: [
- preprocess({
- less: true,
- postcss: postcssConfig,
- sass: { renderSync: true },
- scss: { renderSync: true },
- stylus: true,
- typescript: true,
- }),
- ],
+ preprocess: [vitePreprocess()],
};
// Disable hot mode during the build
@@ -65,7 +50,7 @@ function getViteConfiguration({
return {
optimizeDeps: {
- include: ['@astrojs/svelte/client.js', 'svelte', 'svelte/internal'],
+ include: ['@astrojs/svelte/client.js'],
exclude: ['@astrojs/svelte/server.js'],
},
plugins: [svelte(resolvedOptions)],
@@ -78,13 +63,12 @@ export default function (options?: Options | OptionsCallback): AstroIntegration
name: '@astrojs/svelte',
hooks: {
// Anything that gets returned here is merged into Astro Config
- 'astro:config:setup': ({ command, updateConfig, addRenderer, config }) => {
+ 'astro:config:setup': ({ command, updateConfig, addRenderer }) => {
addRenderer(getRenderer());
updateConfig({
vite: getViteConfiguration({
options,
isDev: command === 'dev',
- postcssConfig: config.style.postcss,
}),
});
},