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

Unexpected token #467

Open
Fischchen opened this issue Aug 7, 2022 · 3 comments
Open

Unexpected token #467

Fischchen opened this issue Aug 7, 2022 · 3 comments
Milestone

Comments

@Fischchen
Copy link

Hello,
I'm currently having the problem that any markdownfile I try to read using the mdsvex preprocessor just returns:

500
E:/Repos/Website/src/routes/markdown.svx:5:0 Unexpected token
 3 |  import { create_ssr_component } from “svelte/internal”;</p>
 4 |  <p>const Markdown = create_ssr_component(($$result, $$props, $$bindings, slots) => {
 5 |  return <code>&lt;h1&gt;Test&lt;/h1&gt;</code>;
      ^
 6 |  });</p>
 7 |  <p>export default Markdown;</p>

This happens every time, with any markdown, even empty markdown or just # Test
I've installed it via https://github.com/svelte-add/mdsvex.
I'm running the current version of svelte + sveltekit as well as tailwind (if that matters)
I'm very new to svelte so, I'm sorry if I missed something.

Regards,
Fischchen

@Fischchen
Copy link
Author

Fischchen commented Aug 7, 2022

Ok, to add this also fails any build:

3:04:22 PM: [vite-plugin-svelte] /opt/build/repo/src/routes/markdown.svx:18:0 The keyword 'let' is reserved
3:04:22 PM: file: /opt/build/repo/src/routes/markdown.svx:18:0
3:04:22 PM:  16 |  } from “svelte/internal”;</p>
3:04:22 PM:  17 |  <p>function create_fragment(ctx) {
3:04:22 PM:  18 |  let h1;
3:04:22 PM:        ^
3:04:22 PM:  19 |  let t;</p>
3:04:22 PM:  20 |  <p>	return {
3:04:22 PM: error during build:
3:04:22 PM: ParseError: The keyword 'let' is reserved
3:04:22 PM:     at error (file:///opt/build/repo/node_modules/svelte/compiler.mjs:17799:19)
3:04:22 PM:     at Parser$1.error (file:///opt/build/repo/node_modules/svelte/compiler.mjs:17875:9)
3:04:22 PM:     at Parser$1.acorn_error (file:///opt/build/repo/node_modules/svelte/compiler.mjs:17869:14)
3:04:22 PM:     at read_expression (file:///opt/build/repo/node_modules/svelte/compiler.mjs:8735:16)
3:04:22 PM:     at mustache (file:///opt/build/repo/node_modules/svelte/compiler.mjs:17558:28)
3:04:22 PM:     at new Parser$1 (file:///opt/build/repo/node_modules/svelte/compiler.mjs:17834:21)
3:04:22 PM:     at parse$3 (file:///opt/build/repo/node_modules/svelte/compiler.mjs:17966:20)
3:04:22 PM:     at compile (file:///opt/build/repo/node_modules/svelte/compiler.mjs:32349:17)
3:04:22 PM:     at compileSvelte2 (file:///opt/build/repo/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:337:20)
3:04:22 PM:     at async Object.transform (file:///opt/build/repo/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1820:25)

@janzheng
Copy link

This happened to me because I'd also been trying out vite-plugin-markdown and they seem to collide. I removed the markdown() plugin from vite.config.js and it worked. The file looks like:

import { sveltekit } from "@sveltejs/kit/vite";

const config = {
  plugins: [
    // markdown(),
    // markdown({ mode: Mode.HTML }),
    sveltekit({
      extensions: ['.svelte', '.svx', '.md'],
    }),
    ...
  ],
  ...
}

@donmccurdy
Copy link

@pngwn pngwn added this to the 1.0 milestone Feb 23, 2024
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

4 participants