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

data-main指定js,在编译打包后,页面运行时仍然被请求 #50

Open
paohuoche opened this issue Apr 19, 2016 · 5 comments
Open

Comments

@paohuoche
Copy link

paohuoche commented Apr 19, 2016

原始页面中有<script data-main="js/h5" src="/js/lib/require.js"></script>,
编译后页面中为:

<script data-main="js/h5" src="/js/lib/require_ce64807.js"></script>
<script type="text/javascript" src="/pkg/_h5.html_aio_f69d00d.js"></script>

这样编译后还会请求h5.js,请问如何解决?

@2betop
Copy link
Contributor

2betop commented Apr 19, 2016

感觉 js/h5 并没有打包在 h5.html_aio.js 中,你找找看

@paohuoche
Copy link
Author

在,的确在,而且在h5.html_aio.js的最下面

@2betop
Copy link
Contributor

2betop commented Apr 19, 2016

那考虑换种写法吧?

<script data-main="js/h5" src="/js/lib/require.js"></script>

改成

<script src="/js/lib/require.js"></script>
<script>
  require(['js/h5'])
</script>

@paohuoche
Copy link
Author

paohuoche commented Apr 20, 2016

按照你的提示做了,不知道为什么会出现这么一行代码<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="js/h5" src="./js/h5.js"></script>
??
又去请求h5.js

@andeshi
Copy link

andeshi commented May 19, 2017

paohuoche你好,这个问题解决了吗?

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

3 participants