]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
webpack: handle _global img folder
authorKevin Decherf <kevin@kdecherf.com>
Sun, 15 Oct 2017 21:57:35 +0000 (23:57 +0200)
committerKevin Decherf <kevin@kdecherf.com>
Sun, 15 Oct 2017 22:01:52 +0000 (00:01 +0200)
Fixes missing image files after composer cleaning assets

Source of requireAll(): https://stackoverflow.com/a/30652110

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
app/Resources/static/themes/_global/share.js
app/config/webpack/prod.js

index d707861656539b3b650a2e3332dc7d4b6a31fa92..15206b374bc383940226de8cfb43dd2f573eb9ea 100644 (file)
@@ -1 +1,4 @@
 import './share.scss';
+
+function requireAll(r) { r.keys().forEach(r); }
+requireAll(require.context('./img/', true, /\.(jpg|png|gif|svg|ico)$/));
index 44961cc581a463e64304fb06877e04200179b19f..17b8c38429d90517810fce8444dadb1d9d3bc260 100644 (file)
@@ -76,7 +76,8 @@ module.exports = function () {
           }),
         },
         {
-          test: /\.(jpg|png|gif|svg)$/,
+          test: /\.(jpg|png|gif|svg|ico)$/,
+          include: /node_modules/,
           use: {
             loader: 'file-loader',
             options: {
@@ -84,6 +85,17 @@ module.exports = function () {
             },
           },
         },
+        {
+          test: /\.(jpg|png|gif|svg|ico)$/,
+          exclude: /node_modules/,
+          use: {
+            loader: 'file-loader',
+            options: {
+              context: 'app/Resources/static',
+              name: '[path][name].[ext]',
+            },
+          },
+        },
         {
           test: /\.(eot|ttf|woff|woff2)$/,
           use: {