'Can I use an external javascript file with svelte for settings without bundling it?
My company uses a web based productivity tool (just HTML with some Javascript in it and it's hosted on a network share, not a web server). I'm trying to make a lot of improvements to it and one thing I'd like to do is migrate it to something like Svelte to make it easier to maintain and build on top of. After being built it can run in a directory easily, however I'd like to store a config settings in a seperate js file so others can make changes without having to rebuild it each time. I was curious if there's a way to have Svelte interact with data stored in an external JS file?
Solution 1:[1]
What you can do is have one script where you add your settings to the document:
document.myapp.settings = {
name: 'aaa'
}
If you make sure this script has been load before the Svelte script runs, you can simply read these values with document.myapp.settings.name.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stephane Vanraes |
