I have a somewhat non-standard need where I need to store a large blob of data in a text file, and import it into svelte. Currently, my object looks like this
<script>
let data = "A very large string";
</string>
<div>
{data}
</div>
I want to store the contents of data as a string, which is dynamically compiled into the object, e.g.
<script>
let data = import("myData.txt");
</string>
<div>
{data}
</div>
I Can't see anything in the svelte documentation that says this is supported, but I'm new to svelte / front-end dev, so maybe someone can suggest a workaround?
Store the large blob of data inside a .txt file on the server at a location where it can be publicly accessed, and then use fetch() to load it from there.
let data = await fetch('https://localhost/public_path/myData.txt')
.then(res => res.text());
Note: I have no experience with svelte
All the best.