Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e54440

Browse files
authored
Merge pull request #475 from dotkernel/issue-439
updated webpack config - fonts fix
2 parents 06760b2 + 73ae088 commit 4e54440

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

public/fonts/app/Avenir-Light.ttf

86.6 KB
Binary file not shown.

public/fonts/app/Minion-Pro.ttf

261 KB
Binary file not shown.

webpack.config.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = {};
6059
let copyImages = [];
6160
let rules = generateBaseRules();
6261

@@ -67,11 +66,12 @@ let rules = generateBaseRules();
6766
*
6867
*/
6968
appModules.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: /\.(woff|woff2|eot|ttf|otf|svg)$/,
94+
include: [
95+
path.resolve(__dirname, './src/' + appModule.assets_path)
96+
],
97+
exclude: [/images?|img/],
98+
use: [
99+
{loader: 'file-loader'}
100+
]
101+
})
102+
}
89103
});
90104

91105
/*

0 commit comments

Comments
 (0)