svelte-kanban icon indicating copy to clipboard operation
svelte-kanban copied to clipboard

Add $stores alias

Open dev-guy opened this issue 1 year ago • 1 comments

Adding a new path alias for the latest SvelteKit and Vite has proven to be very difficult. I could get everything working except for npm build which causes files under dist/ to still contain $stores . However, $lib is properly replaced

This does not work:

vite.config.ts:

	resolve: {
		alias: {
			$lib: path.resolve("./src/lib"),
			$stores: path.resolve("./src/lib/stores")
		}

tsconfig.js:

"compilerOptions": {
		"paths": {
			"$lib": ["./src/lib"],
			"$lib/*": ["./src/lib/*"],
			"$stores": ["./src/lib/stores"],
			"$stores/*": ["./src/lib/stores/*"]
		}

dev-guy avatar Sep 11 '23 15:09 dev-guy

The latest SvelteKit doesn't require changing vite or ts config files. Instead, aliases are added to the svelte config file.

dev-guy avatar Sep 19 '23 16:09 dev-guy