增加提前配置 seajs_config #248

Closed
lifesinger opened this Issue Jul 4, 2012 · 7 comments

Projects

None yet

5 participants

@lifesinger
Member

有时候,我们想将 seajs 与常用类库打包在一起下载:

<script src="https://a.alipayobjects.com/static/??arale/seajs/1.2.0/sea.js,arale/jquery/1.7.2/jquery.js,biz/common/1.0.0/common.js"></script>

这时,seajs 的 base 路径可能获取不正确,如果打包在一起的模块还依赖 alias 和 map 等配置,也会出问题。一个解决办法是,参考 requirejs 的做法,允许提前定义配置项:

<script>
var seajs_config = {
    base: 'https://a.alipayobjects.com/static/arale/',
    alias: { ... }
    ...
}
</script>
<script src="https://a.alipayobjects.com/static/??arale/seajs/1.2.0/sea.js,arale/jquery/1.7.2/jquery.js,biz/common/1.0.0/common.js"></script>

这个方案简单可扩展,比 seajs 里面硬编码去根据 combo 规则解析得到 base 的方案好。

@lepture
Member
lepture commented Jul 4, 2012

@sofish #245 看这里。

@sofish
sofish commented Jul 4, 2012

@lepture 解决了?

@lepture
Member
lepture commented Jul 4, 2012

@sofish close 的时候就是解决了。

@lifesinger
Member

保持简单,先不增加这个复杂度。目前只需要针对 combo 情况下,正确获取 seajs 的实际路径就能解决。

@lifesinger lifesinger closed this Jul 4, 2012
@lifesinger
Member

还没解决,我在处理

@chx007
Contributor
chx007 commented Jul 4, 2012

有这个特性很不错啊!

@yss
yss commented Dec 25, 2013

为什么这个需求一直没有增加呢?非常期待。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment