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

Detect svelte.config.mjs for Deno #12678

Closed
yetdragon opened this issue Sep 16, 2024 · 3 comments
Closed

Detect svelte.config.mjs for Deno #12678

yetdragon opened this issue Sep 16, 2024 · 3 comments

Comments

@yetdragon
Copy link

Describe the problem

SvelteKit currently doesn't officially support svelte.config.mjs, and I understand why (as discussed in #12331). However, this becomes a problem when using SvelteKit with Deno because, unlike Node.js, Deno recognizes a file as a module only if it has an .mjs extension. Due to this, the Svelte IntelliSense incorrectly shows an error:

Error in svelte.config.js

SyntaxError: Cannot use import statement outside a module (svelte)

This issue is similar to one faced by Vite, which was resolved by using vite.config.mjs.

Although, Deno is a very niche development runtime for SvelteKit, it would be nice to have support for it in SvelteKit.

Describe the proposed solution

Make SvelteKit detect svelte.config.mjs as a configuration file.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

@marvinhagemeister
Copy link

An alternative solution would be to check for a deno.json or deno.jsonc file and treat the project as ESM by default. It's likely that there is some existing code that checks for package.json and for type: "module" that causes the problem in the first place. Extending that logic for Deno might be the best solution.

@dummdidumm
Copy link
Member

What's speaking against adding type: "module" to the package.json? From what I understand it's irrelevant for Deno, but for local tooling it would then know that the file is ESM.

@yetdragon
Copy link
Author

What's speaking against adding type: "module" to the package.json? From what I understand it's irrelevant for Deno, but for local tooling it would then know that the file is ESM.

This fixed the issue. I mistakenly assumed this as Deno-related problem but it seems not. I will close the issue. Sorry for bothering.

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

No branches or pull requests

3 participants