How to load a json file from resources
# javascript
h
How to load a json file from resources
t
From
src/main/resources
?
c
I don’t think those resources get bundled into application code for JS. But they should end up in the
distributions
folder where the rest of the app is served by Webpack, so you should be able to fetch those resources with HTTP requests
r
webpack should support json out of the box so you probably can just use
require
the advantage of using
require
is that your json data will be directly available in you app, without the need to fetch it asynchronously
👍 2
b
You'll need to add your resources to webpack modules if you want to require from there
2
t
It can be done via webpack plugin
h
Yes, From
src/main/resources