Linking to JSON data from dist folder
Web Design & IT Services in Swanage, Poole, Bournemouth and Dorset by Matthew Pond
One of the problems I came across recently whilst using Webpack was the fact that once yarn build -p had been run all the assets are given hashed filenames, such as:
At the top of the file that was calling data.json I added the following line which imports the JSON into a variable called jsonData. And because the data is now included via the import rule, Webpacks assets file resolved the naming.
import * as jsonData from '../json/data.json';