Import asset from JSON file

Viewed 79

My webpack app currently loads .json files using the recommended asset/resource module.

However, my .json file references static assets:

{
    "name": "MyApp",
    "icons": [
        {
            "src": "/assets/images/icon-192.png",
            "type": "image/png",
            "sizes": "192x192",
            "purpose": "any maskable"
        }
    ]
}

I would like those assets to be added to the dependency graph automatically, just like the html-loader does. Is there a loader that can do that for JSON, or am I stuck copying those assets with copy-webpack-plugin?

0 Answers
Related