ykpublicgame / layaykfamework Goto Github PK
View Code? Open in Web Editor NEWLaya前端开源框架
Laya前端开源框架
请问 服务端代码可以提供吗?
用于个人学习 谢谢~
最近考虑项目从1.x切换到2.x,对于两者编码规范和编译都有很多差异,论坛上有几位同学提出相关问题,但可惜没有答案。所以特意去学习相关信息,总结出下面的经验,如有错误,希望指出,谢谢!
1.x
没有模块(module)的概念,只有命名空间(namespace),两个关键字都能编译通过,但是没有差别。
所有代码都能直接访问,不需要也没办法使用require("./xxx")
或者import * as xxx from "./xxx"
,可以通过使用别名访问:import a = x.y;
2.x
有模块(module)的概念,但是不能使用命名空间(namespace), 虽然都能编译通过,但是namespace的代码不会被编译进去bundle.js。原因看后面。
模块的导出和加载使用ES6标准的export或者export default
和import a from "./a"
。
由于使用了browserify和tsify编译,browerify是根据入口文件开始查找所有import文件,根据依赖关系进行编译,所以根本找不到namespace的定义文件。也就是说namespace没办法使用。
补充:目前laya不支持require,否则应该能通过require加载namespace的文件,这样就能通过全局直接访问了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.