Files
cocos4/templates/native/index.ejs
T
Santy-Wang 7bc135e1c7 adjust initialization process (#11143)
* adjust init process

* fix bugs

* restructure

* tweak

* delete useless code

* fix ci

* support more platform and fix some bugs

* mark internal

* tweak

* add docs

* add docs and little adjustment

* fix bugs

* adjust decorator execute order

fix mesh error

* fix bugs

* revert some change

* revert auto-generated code

* revert auto-generated code
2022-07-03 21:16:09 +08:00

33 lines
893 B
Plaintext

<% if(polyfillsBundleFile) { %>
// Polyfills bundle.
require("<%= polyfillsBundleFile %>");
<% } %>
// SystemJS support.
window.self = window;
require("<%= systemJsBundleFile %>");
const importMapJson = jsb.fileUtils.getStringFromFile("<%= importMapFile%>");
const importMap = JSON.parse(importMapJson);
System.warmup({
importMap,
importMapUrl: '<%= importMapFile%>',
defaultHandler: (urlNoSchema) => {
require(urlNoSchema.startsWith('/') ? urlNoSchema.substr(1) : urlNoSchema);
},
});
System.import('<%= applicationJs %>')
.then(({ Application }) => {
return new Application();
}).then((application) => {
return System.import('cc').then((cc) => {
require('jsb-adapter/engine-adapter.js');
return application.init(cc);
}).then(() => {
return application.start();
});
}).catch((err) => {
console.error(err.toString());
});