Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

standalone 支持 umd 方案整理 #892

Closed
sorrycc opened this issue Jul 17, 2014 · 6 comments
Closed

standalone 支持 umd 方案整理 #892

sorrycc opened this issue Jul 17, 2014 · 6 comments
Assignees
Milestone

Comments

@sorrycc
Copy link
Member

sorrycc commented Jul 17, 2014

根据上午和 @popomore @hotoo 的讨论,整理如下。

需求:

  1. 可以通过 window 变量、require 或 seajs.use 调用到
  2. 如果文件无依赖,希望不载入 seajs-mini,减少冗余

方案:

  1. 判断是否需要处理依赖,然后分别载 seajs-min 或 define 函数 (只有 define,而且不处理依赖和缓存)
  2. 和 seajs 共用 define 缓存,这样里面定义的模块,可以通过 seajs 直接 use 使用
  3. 最下面加 umd,支持各种 loader 和直接用 window 变量调用
  4. 另外,standalone 实现从 umi 里拆分出来,放到 spmjs/spm-standalonify 下
@afc163
Copy link
Member

afc163 commented Jul 17, 2014

browserify 命令行有一个 -r 参数,可以参考下。

@popomore popomore added this to the 3.1 milestone Jul 17, 2014
@popomore popomore added the build label Jul 17, 2014
@sorrycc sorrycc modified the milestones: 3.2, 3.1 Jul 21, 2014
@sorrycc sorrycc mentioned this issue Jul 21, 2014
10 tasks
@sorrycc sorrycc self-assigned this Jul 25, 2014
@sorrycc
Copy link
Member Author

sorrycc commented Aug 29, 2014

已完成。

@sorrycc sorrycc closed this as completed Aug 29, 2014
@shepherdwind
Copy link

怎么使用啊?有没有一个例子

@sorrycc
Copy link
Member Author

sorrycc commented Sep 13, 2014

$ spm build --include standalone

# 在 standalone 的基础上添加 umd wrap
$ spm build --include umd

edited.

@afc163
Copy link
Member

afc163 commented Sep 13, 2014

楼上是不是写错了,两个都一样的。。

@afc163
Copy link
Member

afc163 commented Sep 13, 2014

可以把参数补充到 spmjs.io 的文档下去。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants