hefangshi / fis-postpackager-autoload Goto Github PK
View Code? Open in Web Editor NEW用于自动加载模块化资源的FIS插件
License: MIT License
用于自动加载模块化资源的FIS插件
License: MIT License
我在页面上设置了这个,但是没有生产到我页面指定的位置上
触发条件:
1.依赖第三方插件时:require('plugin/jquery/jquery.js')。
2.fis-postprocessor-amd的‘globalAsyncAsSync’配置项为true。
3.fis-postpackager-autoload的‘useSiteMap’为false。
因为useSiteMap关闭,而autoload将依赖的文件提前加载,所以会将对应的资源从 resourceMap 中删除,但是插件没有经过mod处理,所以没有 define。。
所以在页面加载的时候,因为 resourceMap 里没有插件的配置,所以会以错误的路径重新加载js(其实已经提前加载了,只是在resourceMap里找不到),从而报错。
建议:
将 return file && !file.isCssLike && !usedSync[dep]; 改为 return !file.isMod || (file && !file.isCssLike && !usedSync[dep]);
或者在roadmap增加一项 'isExt: true', 然后:
将 return file && !file.isCssLike && !usedSync[dep]; 改为 return file.isExt || (file && !file.isCssLike && !usedSync[dep]);
目前后端方案都能实现这个需求。再替换 script 的时候,是否加个 pkg 判断就OK?
rt
我打包完了。。。发现那些注释还在。想删除,咋弄啊?》
我想次插件增加一个功能,就是autocombine的output文件名,可以定义到跟当前文件有关联的名称。
增加了如下代码:
var arry = [];
for(var key in ret.src){
arry.push(ret.src[key].filename);
}
var subpath = settings.output.replace('${index}', combineCount)
.replace('${name}', arry[0])
.replace('${hash}', fis.util.md5(stable(has).join(','), 5))
+ '.' + fileExt;
配置文件:
fis.config.set('settings.postpackager.simple.output', 'pkg/auto_${name}');
index.html 编译后,得到pkg/auto_index.js。
忘您可以采纳更新,麻烦同时更新到fis-pure中。
文档好少啊。。源码看的云里雾里
更新之后,所有文件引入都会死循环加载
不停的读取
injectAsync 里面的 pkg/page_map 的路径能不能和 injectSiteAsync 里的
var subpath = (settings.subpath || 'pkg/map.js').replace(/^//, '');
一样也能自定义?
目前是直接到根目录下了
var subpath = 'pkg/page_map_${index}.js'.replace('${index}', asyncCount);
最主要的是所在目录能不能别直接到根目录下,pkg能重命名最好了。
代码洁癖和强迫症HOLD不住啊。。。
就是说,resourcemap是否在pkg/page_map_XXX这个默认目录下,不能自定义?
199行源码是:var subpath = 'pkg/page_map_${index}.js'.replace('${index}', asyncCount);
当第三方库中有 require 关键字时, 会提示 [NOTICE] can't find dep resource ['./xxx'],但不影响编译结果。
block pagescript
然而build后 这个替换失败了
(发现在injectAutoLoad 时 file的 依赖是空对象 {} )
我已经把pug 文件设置为 isHtmlLike了 这个必须使用html 文件才行么? 或者是哪里有什么设置
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.