Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fis2 --pack后引用的JS部分代码被改变如何解决 #830

Open
dengxyccc opened this issue Dec 8, 2020 · 3 comments
Open

fis2 --pack后引用的JS部分代码被改变如何解决 #830

dengxyccc opened this issue Dec 8, 2020 · 3 comments

Comments

@dengxyccc
Copy link

项目使用的fis2,有一个文件 a-dev.js 通过--pack合并生成叫a.js ,在打包的时候 加上了--pack,实现了效果,但是后面发现加了--pack之后我的html 引用的require.js 里面的data-main被删除了,另外有一段根据浏览器内核加载js的代码也是直接被删除了,想问下这种如何解决
源码
`<script src="/appframe/kernel/require.js" data-main="/nresource/assets/js/index"></script>

<script type="text/javascript"> var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; return { //移动终端浏览器版本信息 trident: u.indexOf('Trident') > -1, //IE内核 presto: u.indexOf('Presto') > -1, //opera内核 webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核 mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/), //是否为移动终端 ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 iPad: u.indexOf('iPad') > -1, //是否iPad webApp: u.indexOf('Safari') == -1 //是否web应该程序,没有头部与底部 }; }(), language: (navigator.browserLanguage || navigator.language) .toLowerCase() } if (browser.versions.ios || browser.versions.iPhone || browser.versions.iPad) { document.write("<script src='/nresource/assets/js/terminalInterface.js'><\/script>"); } </script>`

打包后:

`<script type="text/javascript" charset="utf-8" src="/appframe/kernel/require_f9fe835.js"></script>

<script type="text/javascript" charset="utf-8" src="/nresource/assets/js/terminalInterface.js"></script>`
@oxUnd
Copy link
Contributor

oxUnd commented Dec 11, 2020

你用得哪个解决方案?

@dengxyccc
Copy link
Author

暂时还没解决呢,因为--pack 一直没使用过,突然使用出现这个问题,暂时还没找到解决方案

@oxUnd
Copy link
Contributor

oxUnd commented Dec 15, 2020

默认情况下 --pack 只会对你的代码进行合并处理,但并不会改你的 html,你应该是用了这个解决方案?https://github.com/fex-team/fis-pure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants