Skip to content

sv create syntax errors in lucia demo #761

@sean-c-johnston

Description

@sean-c-johnston
  • Use pnpx sv create to generate a Svelte project
  • Select the minimal template
  • Add lucia auth. While I don't think other addons will affect reproducing this, for full clarity I also added
    • eslint
    • prettier
    • vitest
    • playwright
    • drizzle using postgres and Postgres.js
    • storybook
    • mcp (remote)
  • Say yes when prompted to add a demo for lucia
  • Install with pnpm
  • Finish the CLI prompts and open the project

At this stage, the following files should have a syntax error due to an incorrectly escaped closing </script> tag (see image).

  • routes/demo/lucia/login/+page.svelte
  • routes/demo/lucia/+page.svelte
Image

Looking at packages/addons/lucia/index.ts line 633, the string provided seems fine, so I can only assume there's an issue in dedent somewhere?:

return dedent`
	<script ${ts("lang='ts'")}>
		import { enhance } from '$app/forms';
		${ts("import type { PageServerData } from './$types';\n")}
		${s5(`let { data }${ts(': { data: PageServerData }')} = $props();`, `export let data${ts(': PageServerData')};`)}
	</script>     // The closing tag in question.

	<h1>Hi, {data.user.username}!</h1>
	<p>Your user ID is {data.user.id}.</p>
	<form method='post' action='?/logout' use:enhance>
		<button>Sign out</button>
	</form>
`;

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpkg:addsv add

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions