Answer the question
In order to leave comments, you need to log in
Webpack - how to include json files in dist folder?
I searched on different sources about the json-loader, but from the Webpack 2 version, the loader should automatically work. With the npm run build command (building the project in dist), I managed to put information from json files into dist/main.js if I do import "./path/.json" in my src/index.js , but on the page the data from json is still not output.
How can I build the project in such a way that either data from json nested in dist/main.js is displayed on the page, or that webpack collects a separate db folder in dist and puts all json files there?
Answer the question
In order to leave comments, you need to log in
Webpack builds the application. If you import something, it is also collected. In particular, json is in the form of ready-made objects inside js files. If you need to include external json files after the build, you need to include them manually as usual: for example, using fetch.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question