@@ -18,7 +18,8 @@ const appModules = [{
1818 assets_path : './App/assets' ,
1919 styles : true ,
2020 js : true ,
21- images : true
21+ images : true ,
22+ fonts : true
2223} ] ;
2324
2425
@@ -54,9 +55,7 @@ const TerserPlugin = require('terser-webpack-plugin');
5455
5556
5657// dynamically build webpack entries based on registered app modules
57- let entries = {
58- app : [ ]
59- } ;
58+ let entries = { } ;
6059let copyImages = [ ] ;
6160let rules = generateBaseRules ( ) ;
6261
@@ -67,11 +66,12 @@ let rules = generateBaseRules();
6766 *
6867 */
6968appModules . forEach ( function ( appModule ) {
69+ entries [ appModule . name ] = [ ] ;
7070 if ( appModule . js === true ) {
71- entries . app . push ( appModule . assets_path + '/js/index.js' )
71+ entries [ appModule . name ] . push ( appModule . assets_path + '/js/index.js' )
7272 }
7373 if ( appModule . styles === true ) {
74- entries . app . push ( appModule . assets_path + '/scss/index.scss' )
74+ entries [ appModule . name ] . push ( appModule . assets_path + '/scss/index.scss' )
7575 }
7676 if ( appModule . images === true ) {
7777 copyImages . push ( { from : appModule . assets_path + '/images' , to : './images/' + appModule . name } ) ;
@@ -86,6 +86,20 @@ appModules.forEach(function (appModule) {
8686 ]
8787 } )
8888 }
89+ if ( appModule . fonts === true ) {
90+ copyImages . push ( { from : appModule . assets_path + '/fonts' , to : './fonts/' + appModule . name } ) ;
91+
92+ rules . push ( {
93+ test : / \. ( w o f f | w o f f 2 | e o t | t t f | o t f | s v g ) $ / ,
94+ include : [
95+ path . resolve ( __dirname , './src/' + appModule . assets_path )
96+ ] ,
97+ exclude : [ / i m a g e s ? | i m g / ] ,
98+ use : [
99+ { loader : 'file-loader' }
100+ ]
101+ } )
102+ }
89103} ) ;
90104
91105/*
0 commit comments