how do I import/load a JSON file from the resource...
# javascript
b
how do I import/load a JSON file from the resources/ folder at runtime and in a test? code will run in a browser and tests have currently no special runtime set up so I guess it's using the default
1
t
Do you want to include it in bundle?
b
ideally both: load it from the server and/or include it in the bundle; trying to figure things out right now
including it in the bundle uses a require right? unsure about the path though
t
For loading you can use
fetch
For including inside
import
function
b
inside tests, what paths/methods do you use there?
t
I use relative path from
resources
folder
Methods -
import
or
require
For valid path resolving you will need additional Webpack configuration - it's generated in my case
You can check generated configuration here (after build configuration folder will be created)
b
thank you!