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

Use defaults passed to sveltePreprocess #212

Closed
jankalfus opened this issue Apr 5, 2021 · 3 comments
Closed

Use defaults passed to sveltePreprocess #212

jankalfus opened this issue Apr 5, 2021 · 3 comments

Comments

@jankalfus
Copy link

jankalfus commented Apr 5, 2021

The official Svelte plugin for VS Code is able to load preprocess options passed to sveltePreprocess in svelte.config.js, and set up defaults correctly. It would be awesome to have support for that in this plugin as well.

For example, if one sets up typescript in svelte.config.js as the default language:

const sveltePreprocess = require("svelte-preprocess");

const preprocessOptions = {
  sourceMap: true,
  defaults: {
    script: "typescript",
  },
};

module.exports = {
  preprocess: sveltePreprocess(preprocessOptions),
};

...then typescript can be used in the script tag without having to specify lang:

<script>
  export let name: string;
</script>

This works nicely in VS Code with the official Svelte plugin:
obrazek

But fails in WebStorm with this plugin (0.18.0.203):
obrazek

Related issue from the VS Code plugin repository: sveltejs/language-tools#593

@tomblachut
Copy link
Owner

Yes indeed that would be nice, thanks for raising!

@mikerourke
Copy link

@tomblachut I just wanted to chime in here and say you can probably close this issue. Svelte is deprecating the defaults option in svelte-preprocess and recommending you explicitly specify the language in the <script> tag (i.e. <script lang="ts">. Here's the message I'm seeing in my terminal:

[svelte-preprocess] Deprecation notice: using the "defaults" option is no longer recommended and will be removed in the next major version. Instead, define the language being used explicitly via the lang attribute.

By the way, thank you so much for all the great work on this plugin! I don't know what I'd do without it.

@tomblachut
Copy link
Owner

@mikerourke thanks for the info and for kind words :)

I'll rename this issue to better reflect that it's specifically about "defaults" and close it.

@tomblachut tomblachut changed the title Use options passed to sveltePreprocess Use defaults passed to sveltePreprocess Aug 30, 2021
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