I am a complete novice about modular programming, I hope you can give me some advice
In my index.html, index.js needs to call zepto.js in the component component, but it cannot be called normally, and there is no alarm. mistake;
index.js source code is as follows:
After publishing to the test machine using fis3, index.js becomes Now:
In this code define('static/index/index', function(...){}, this function wraps all the source code content, so it cannot run normally. If you remove the outer function of this define, it can It works normally. But the question is why it is automatically generated, and how should I write index.js so that there will be no problems;
zepto默认库并没有包含AMD模块,也就是说,并不能用AMD加载。如果用requirejs加载的话,你要把它写到shim里,这里丢个我以前写的config:
不过我并没解决为啥 build zepto 模块的时候带上AMD模块也不行(有可能是编译出来的库不合规或者是zepto的AMD这块本身有的问题?)……可以说这是个比较懒的解决方案吧。
另外,Fis我没用过,但用requirejs的时候我一般都是在HTML里用一个script标签解决问题,比如:
然后把require都写到main.js里就好。
补充个zepto构建地址。