page js and css are introduced through requirejs, due to the order, there is no css appearance first, and then load the style, the page is normal, is there any way to solve this problem?
page js and css are introduced through requirejs, due to the order, there is no css appearance first, and then load the style, the page is normal, is there any way to solve this problem?
js resource loading takes a certain time, and flickering is inevitable. In this case, you can consider making some loading optimization
for example: loading starts loading, some css layout-related files or js files are loaded (processed in the callback after loading is successful), and loading
is finished. Otherwise, you can only split the style or introduce it in the way of header link or @ import. Possible changes are relatively large
css extracted and put in front of loading
you can put css in front of the dependency, or you can configure the css path in the deps array of modules in require.config
require(["css!../style.css", "module"], function(){
})
//
require.config({
shim:{
module:["css!../style.css"]
}
})
require(["module"], function(){})