-
-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Here's my error:
Error: Unable to process 'vite.config.ts'. Reason: Cannot read properties of undefined (reading 'length')
│ at Object.file (file:///private/tmp/bunx-503-sv@latest/node_modules/sv/dist/addons-Br9tic5t.js:1066:35)
│ at Object.run (file:///private/tmp/bunx-503-sv@latest/node_modules/sv/dist/addons-Br9tic5t.js:5437:6)
│ at runAddon (file:///private/tmp/bunx-503-sv@latest/node_modules/sv/dist/addons-Br9tic5t.js:1107:14)
│ at applyAddons (file:///private/tmp/bunx-503-sv@latest/node_modules/sv/dist/addons-Br9tic5t.js:1017:50)
│ at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
│ at async runAddCommand (file:///private/tmp/bunx-503-sv@latest/node_modules/sv/dist/bin.js:1071:79)
│ at async file:///private/tmp/bunx-503-sv@latest/node_modules/sv/dist/bin.js:836:25
│ at async runCommand (file:///private/tmp/bunx-503-sv@latest/node_modules/sv/dist/bin.js:565:3)
│
- This happens no matter which package manager I use.
- Based on the error, I think the issue is somewhere around here in the
applyAddons()
functioncli/packages/cli/lib/install.ts
Line 70 in ca3c8b5
multiple: ordered.length > 1
Here's the config:
// vite.config.ts
import { enhancedImages } from "@sveltejs/enhanced-img";
import { sveltekit } from "@sveltejs/kit/vite";
import path from "node:path";
import type { UserConfig } from "vite";
import { kitRoutes } from "vite-plugin-kit-routes";
import browserslist from "browserslist";
import { browserslistToTargets } from "lightningcss";
import devtoolsJson from "vite-plugin-devtools-json";
const $src = path.resolve(__dirname, "./src");
const $db = path.resolve($src, "./types/supabase.ts");
const $lib = path.resolve($src, "./lib");
const $routes = path.resolve($src, "./routes");
const $scripts = path.resolve($lib, "./scripts");
const $stores = path.resolve($scripts, "./stores");
const $images = path.resolve($lib, "./images");
const $components = path.resolve($lib, "./components");
const $containers = path.resolve($components, "./containers");
const $navigation = path.resolve($components, "./navigation");
const $classes = path.resolve($scripts, "./classes");
const config: UserConfig = {
plugins: [
devtoolsJson(),
enhancedImages(),
sveltekit(),
kitRoutes({
format: "variables",
}),
],
server: {
open: true,
},
resolve: {
alias: {
$db,
$scripts,
$routes,
$stores,
$images,
$classes,
$components,
$containers,
$navigation,
},
},
optimizeDeps: {
exclude: ["svelte-inspect-value"],
},
build: {
sourcemap: true,
target: "esnext",
cssMinify: "lightningcss",
},
css: {
transformer: "lightningcss",
lightningcss: {
targets: browserslistToTargets(browserslist("defaults, not ie 11")),
},
},
};
export default config;