diff options
Diffstat (limited to 'config/webpack/plugins')
| -rw-r--r-- | config/webpack/plugins/create-manifest-webpack-plugin/index.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js index 3a16770..a1a21a8 100644 --- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js +++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js @@ -14,7 +14,7 @@ class CreateManifestPlugin { stage: compiler.webpack.Compilation.PROCESS_ASSETS_ADDITIONAL, additionalAssets: true }, - () => { + assets => { const scripts = formatScripts(require(path.resolve(SOURCE_DIR, "scripts.json"))); const manifest = webpackRequire("plugins/create-manifest-webpack-plugin/manifest-template.json"); manifest.version = require(path.resolve(ROOT_DIR, "package.json")).version; @@ -30,6 +30,23 @@ class CreateManifestPlugin { } } + const resources = []; + + for (const assetName in assets) { + if (/^assets\/.*\.(jpg|png|gif)$/.test(assetName)) { + resources.push(assetName); + } + } + + if (resources.length > 0) { + manifest.web_accessible_resources = [ + { + resources, + matches: [ "<all_urls>" ] + } + ]; + } + compilation.emitAsset( "manifest.json", new sources.RawSource(JSON.stringify(manifest)) |
