问题截图:
(场景还原:ionic serve运行后,执行ionic cordova build android --prod打包,然后刷新页面。打包过程重新生成了一遍www)
1、安装copyfiles 插件
npm install copyfiles --save
2、创建文件hooks/copy-fonts.js:
var copyfiles = require('copyfiles');
module.exports = function (context) {
copyfiles([
'node_modules/ionic-angular/fonts/roboto-regular.ttf',
'node_modules/ionic-angular/fonts/roboto-regular.woff',
'node_modules/ionic-angular/fonts/roboto-regular.woff2',
'node_modules/ionic-angular/fonts/roboto-medium.ttf',
'node_modules/ionic-angular/fonts/roboto-medium.woff',
'node_modules/ionic-angular/fonts/roboto-medium.woff2',
'node_modules/ionic-angular/fonts/roboto-bold.ttf',
'node_modules/ionic-angular/fonts/roboto-bold.woff',
'node_modules/ionic-angular/fonts/roboto-bold.woff2',
'www/assets/fonts'
],
true,
function (){ console.log("The font files has been copied");}
);
};
3、在config.xml中配置
<hook src="src/assets/js/hooks/copy-fonts.js" type="after_prepare" />
找到答案的网站:【Ionic build –prod IOS stops without a error message】
补充资料:【关于config.xml的详细说明】
网友评论