question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MDsveX + svelte@next (i.e. Snowpack)

See original GitHub issue

Has anyone already tried out/figured out how to use MDsveX with svelte@next using Snowpack as bundler as demoed in https://youtu.be/qSfdtmcZ4d0? I.e. start a project with npm init svelte@next my-app && cd my-app && npm i && npm i -D mdsvex. Do I just import mdsvex in svelte.config.js and it should work?

const { mdsvex } = require(`mdsvex`)

module.exports = {
  adapter: `@sveltejs/adapter-static`,
  preprocess: mdsvex(),
  extensions: [`.svelte`, `.svx`],
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rmunncommented, Jan 5, 2021

Update: This appears to have nothing to do with mdsvex!

I commented out the msdvex pre-processor in my svelte.config.js and the problem persisted. A bit more poking around led me to the create_manifest_data function in @svelte/kit’s create_app.js file. Its first few lines are:

function create_manifest_data(config, extensions = '.svelte') {
	// TODO support .svelte.md etc?
	const cwd = config.files.routes;
	const component_extensions = extensions.split(' ');

And it’s called in two places in @svelte/kit, one in index.js and one in index2.js. The first call looks like this:

	update() {
		const manifest_data = create_app.create_manifest_data(this.config);

		create_app.create_app({
			manifest_data,
			output: '.svelte/assets'
		});

And the second one looks like this:

async function build(config) {
	const manifest = create_app.create_manifest_data(config);

	utils.mkdirp(ASSETS);
	await rimraf(UNOPTIMIZED);
	await rimraf(OPTIMIZED);

	create_app.create_app({
		manifest_data: manifest,
		output: '.svelte/assets'
	});

In both cases, no second parameter is given to create_app.create_manifest_data, so there’s no way to override the .svelte extension. Currently, that is: the TODO comment strongly hints that that ability will be added sometime in the future. But for now, the reason you’re getting the “GET is not implemented for /test” errors or the 404s appears to be because svelte-kit doesn’t yet handle extensions other than .svelte when it’s writing manifests, and with an incorrect manifest you get incorrect behavior.

0reactions
mcmxcdevcommented, Mar 27, 2021

@DrMagPie yeah that most likely works for an import of e.g. Foo.svx, but how to do make it work with a [slug].svelte where you inject a .svx blog post file named like the slug as a <slot/> ? That’s how I had it with Sapper currently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SvelteKit & MDSVEX Blogging - YuJin—@axionbuster
SvelteKit is a serverless toolkit for the Svelte framework, just like Next.js and Gatsby are that for React. In short, SvelteKit helps with ......
Read more >
Svelte, a bright future with Snowpack
Echoing Richard Harris announcements in Svelte Summit 2020: Sapper 1.0 never gonna happen, the new Svelte Kit, Snowpack as build tool, ...
Read more >
MDsveX - Adding Interactivity with Svelte Components in ...
Basically MDX for Svelte. This preprocessor allows you to use Svelte components in your markdown, or markdown in your Svelte components.
Read more >
Newest 'svelte-3' Questions - Page 5 - Stack Overflow
I am trying to use mdsvex to create a markdown blog. I have installed the package using npx svelte-add@latest mdsvex. I then create...
Read more >
Svelte Radio – Podcast - Podtail
Things about Svelte. Sometimes weekly, sometimes not. – Écoutez Svelte Radio instantanément sur votre tablette, téléphone ou navigateur, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found