Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preprocessing .svelte files causes error #685

Open
theetrain opened this issue Jan 2, 2025 · 1 comment
Open

Preprocessing .svelte files causes error #685

theetrain opened this issue Jan 2, 2025 · 1 comment

Comments

@theetrain
Copy link

theetrain commented Jan 2, 2025

Not sure if duplicate of #653.

This impacts sveltejs/cli#384.

Problem

When configuring a new SvelteKit project with mdsvex, using .svelte as an extensions option, an error appears.

svelte.config.js

import { mdsvex } from 'mdsvex'
import adapter from '@sveltejs/adapter-auto'

/** @type {import('@sveltejs/kit').Config} */
const config = {
  kit: {
    adapter: adapter(),
  },

  preprocess: [
    mdsvex({
      extensions: ['.svelte', '.svx'],
    }),
  ],
  extensions: ['.svelte', '.svx'],
}

export default config

src/routes/+page.svelte (fresh project)

<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>

Runtime error:

[vite] Pre-transform error: .svelte-kit/generated/root.svelte:48:68 `</p>` attempted to close an element that was not open
https://svelte.dev/e/element_invalid_closing_tag
[vite] Error when evaluating SSR module /.svelte-kit/generated/root.js:
|- 

[vite] Error when evaluating SSR module /.svelte-kit/generated/server/internal.js:
|- 

[vite] Error when evaluating SSR module /node_modules/@sveltejs/kit/src/runtime/server/index.js:

Environment

  System:
    OS: macOS 15.2
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 396.71 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.volta/tools/image/node/22.11.0/bin/node
    npm: 10.9.0 - ~/.volta/tools/image/node/22.11.0/bin/npm
    pnpm: 9.15.2 - ~/.volta/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.205
    Safari: 18.2
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.3.1 
    @sveltejs/kit: ^2.0.0 => 2.15.1 
    @sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.4 
    mdsvex: ^0.11.2 => 0.11.2 
    svelte: ^5.0.0 => 5.16.0 
    vite: ^5.4.11 => 5.4.11

Issue also appears with [email protected].

@manuel3108
Copy link

Renaming src/routes/+page.svelte to src/routes/+page.svx actually solves the error, without modifying anything else. So this seems to be related to the specific .svelte extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage + Refine
Development

No branches or pull requests

2 participants