Coder Social home page Coder Social logo

fis-postpackager-autoload's People

Contributors

2betop avatar hefangshi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fis-postpackager-autoload's Issues

非标准mod,第三方插件使用bug

触发条件:
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]);

增加功能:autocombine为true时,output文件名跟当前html名称关联

@hefangshi

我想次插件增加一个功能,就是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中。

pkg/page_map 的路径能不能也能自定义?

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不住啊。。。

pkg/page_map_这种目录格式是否固定?

就是说,resourcemap是否在pkg/page_map_XXX这个默认目录下,不能自定义?

199行源码是:var subpath = 'pkg/page_map_${index}.js'.replace('${index}', asyncCount);

如果是Jade写的页面 可以用autoload么?

block pagescript

然而build后 这个替换失败了
(发现在injectAutoLoad 时 file的 依赖是空对象 {} )

我已经把pug 文件设置为 isHtmlLike了 这个必须使用html 文件才行么? 或者是哪里有什么设置

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.