Open webJose opened 3 days ago
Hello @webJose. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction
will be closed if they have no activity within 3 days.
Reproduction
- Make a component library with SvelteKit, build it and consume it in your project.
Please provide a minimal reproduction. Asking maintainers to create component libraries with specific framework is too much.
No problem. But really? You can do npm create svelte@latest
and be done in 5 minutes. But I digress. Anyway, I have an update on this.
I could not follow the recommendation of deps.include
found in the linked issue because it wasn't showing in Intellisense and Vitest documents don't have it. Being that the issue spoke about "v0.31.2", I figured the property just disappeared through the course of time.
Being the stubborn person that I sometimes am, I still typed "inline", and to my surprise it showed up in Intellisense, where I could read that there was a server.deps.inline
property. Using this property works, but I had to do what Svelte core team member Dominik had to do: Use a regular expresion of the form /@scope\/name/
as a regular string would not work.
I think this should be documented as a minimum, as I bet it happens to others. If I may be so bold, I'd like to ask if this is a workaround or is it expected to always be like this?
My updated vite.config.ts
file:
import { sveltekit } from '@sveltejs/kit/vite';
import { svelteTesting } from '@testing-library/svelte/vite';
import { defineConfig } from 'vitest/config';
export default function () {
return defineConfig({
plugins: [sveltekit(), svelteTesting()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}', 'src/**/*.{test,spec}.svelte.{js,ts}'],
environment: 'jsdom',
globals: true,
server: {
deps: {
inline: [/@scope\/name/]
}
}
},
});
};
Thank you very much for the time taken to give me some attention. I appreciate it. Cheers!
The workaround fails when 2 regular expressions are added to server.deps.inline
. Example:
import { sveltekit } from '@sveltejs/kit/vite';
import { svelteTesting } from '@testing-library/svelte/vite';
import { defineConfig } from 'vitest/config';
export default function () {
return defineConfig({
plugins: [sveltekit(), svelteTesting()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}', 'src/**/*.{test,spec}.svelte.{js,ts}'],
environment: 'jsdom',
globals: true,
server: {
deps: {
inline: [/@scope1\/name1/, /@scope2\/name2/]
}
}
},
});
};
Preliminary testing seems to indicate that only the first one is honored.
The workaround fails when 2 regular expressions are added to
server.deps.inline
Without seeing some code and being able to run a minimal reproduction there's not much we can do. Those configuration files look just fine to me.
Describe the bug
I am creating a new bug report since this one got closed and limited, therefore I cannot comment on it.
This problem is still present. The original issue states that "dist" folders are not being given special treatment anymore, and this is why the issue was allegedly closed (as far as I can tell). I am in Vitest 2.1.1 and this still happens.
Reproduction
The error should appear. Current
vite.config.ts
configuration:System Info
Used Package Manager
npm
Validations