Skip to content

Svelte file being listed as a dependency of itself #346

Closed
@kaisermann

Description

@kaisermann

Reported by @dominikg:

The following component:

<script lang="ts" src="./MultiFile.ts"></script>
<template lang="html" src="./MultiFile.html"></template>
<style lang="scss" src="./MultiFile.scss"></style>

Returns the following deps:

0 = "/home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/playground/svelte-preprocess/src/lib/multifile/MultiFile.html"
1 = "/home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/playground/svelte-preprocess/src/lib/multifile/MultiFile.ts"
2 = "/home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/playground/svelte-preprocess/src/lib/multifile/MultiFile.scss"
3 = "/home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/playground/svelte-preprocess/src/lib/multifile/MultiFile.svelte"
4 = "/home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/playground/svelte-preprocess/src/lib/multifile/_someImport.scss"
length = 5

After some research, I found that the scss transformer is the one returning the parent svelte file as a dependency. This can be easily fixed by filtering it out before returning the processed result. If another transformer shows this behaviour, we can move that logic upwards.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions