I want to import a svelte component in a typescript svelte component, it works for typescript file and other type of files, but in this case of svelte component, it resulted in a path error, here’s my code : It only works if i use ../../components/LoadingIcon.svelte instead of src/components/LoadingIcon…
Tag: svelte
Rollup : single html output
I’m trying to package my Svelte app into a single Html file output. I’ve managed to get the desired output with a configuration based on that answer : Output Single HTML File from Svelte Project With “npm run dev” everything is fine with the first build, but I’m having issues fol…
How to run server-sent events in svelte component in sapper
I have a svelte component named [symbol].svelte in which I want to initiate a connection to a streaming service to receive server-sent events. I’ve not found a way to do this successfully. Since EventSource only runs in the browser, I initialized it in the onMount function like so: This works fine, exce…
Svelte store function update
Svelte store documentation shows String or Integer being updated, but I did not find any dynamic function in store. I don’t understand how to make the getData function as a writable in order to notify the html of the change. In the following sample, I would like b to be shown after the updateKey functio…
Error when import a node_module on svelte
i have to create a module to use on my application, but when I import that in my major project i have this error I have not the folder dist/index.js, in the guide I followed I did not see that it was necessary to make the package, also in another project i did not have these problems. My version of
How can I filter through an array an return it instead of another one in this Svelte project?
I am working on a small Svelte application, for learning purposes (Im new to Svelte). The application displays a JSON of countries in a Bootstrap 4 table. There is also a text box that can be used to filter through the countries: See a REPL with the entire code HERE. I am looking for a way to filter through t…
Making class instance reactive in Svelte using stores
I am learning Svelte by creating simple app. The logic is written using classes. The idea is, that all the data needed comes from class instance properties. Instances should not be instantiated more than once. I am using stores to provide components this instances. The problem is I can’t get reactivity …
Props not appearing in Svelte DevTools
I’m building an app as a way to learn Svelte. It’s all functioning perfectly, but when I look at it in Svelte DevTools, the props on components don’t appear, although their values appear in the state as an array. I guess I must be doing something wrong, but can anyone tell me what? The scree…
In svelte, how to `console.log(‘yes’)` when a variable changed?
If we want to print the value of c when it is changed, we can write like above. Because c is used in $ directive literally, so this statement can be reactive to c. But what if I just want to console.log(‘yes’) when c is changed? Obviously, the statement console.log(‘yes’) is not reacti…