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

Svelte 5: Deprecation Warning: context="module" is deprecated, use the module attribute instead #649

Open
ThomasPais opened this issue Aug 25, 2024 · 5 comments

Comments

@ThomasPais
Copy link

Description:

I am encountering deprecation warnings when using Svelte 5. The warnings indicate that context="module" is deprecated and should be replaced with the module attribute svelte 5 preview documentation.

The warnings occur when the markdown files are loaded from the JSON:
+page.server.ts

import type { Post } from '$lib/types';

export async function load({ fetch }) {
	const response = await fetch('api/blog');
	const posts: Post[] = await response.json();
	return { posts };
}

console

[vite-plugin-svelte] src/lib/blog/tenth-post.md:1:8 `context="module"` is deprecated, use the `module` attribute instead

Environment:

Svelte 5
Node.js > 20
MDsveX 0.12.3

Expected Behavior:

No deprecation warnings should appear if the correct attribute is used.

Actual Behavior:

Deprecation warnings appear for each instance of context="module".

@github-project-automation github-project-automation bot moved this to Triage + Refine in mdsvex Aug 25, 2024
@pngwn
Copy link
Owner

pngwn commented Aug 25, 2024

The warning is harmless but I'll fix it before the release of 5.0.

@lts20050703
Copy link

@pngwn Svelte 5.0 is released, I know it's harmless, but it would be nice not to have console (and therefore CI) being spammed with the warning <3

@Sofahamster
Copy link

Is there any update on the issue? I manually patched main.cjs.js to get rid of the console output temporarily. It seems there hasn't been any update to mdsvex in the last three month or so. Is this project still maintained?

@pngwn
Copy link
Owner

pngwn commented Dec 7, 2024

Yeah I forgot about this.

Project is still maintained but this is relatively harmless (although annoying).

@colecrouter
Copy link

You can do this to work around it in Svelte 5. See this comment.

// svelte.config.js

const config = {
    ...
  compilerOptions: {
    warningFilter: (warning) =>
      warning.code !== "script_context_deprecated",
  }
}

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

5 participants