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

构建时如果包含一个模块的多个版本,应给予提醒 #844

Closed
sorrycc opened this issue Jun 18, 2014 · 5 comments
Closed

构建时如果包含一个模块的多个版本,应给予提醒 #844

sorrycc opened this issue Jun 18, 2014 · 5 comments

Comments

@sorrycc
Copy link
Member

sorrycc commented Jun 18, 2014

output a 依赖 b 和 c,b 和 c 依赖不同版本的 d 时,d 冗余

@popomore
Copy link
Member

是提醒还是阻止?

@sorrycc
Copy link
Member Author

sorrycc commented Jun 18, 2014

感觉适当的冗余还是可以接受的,尤其是细颗粒的 package 。

@airyland
Copy link

已经遇到过这种情况,arale有模块依赖 jquery@1.7.2,而我们用的是 jquery@1.8.3。
然后我在页面的公用脚本上写了一段代码。。有没有更合适的方式?

define('jquery/1.7.2/jquery', [], function(require, exports, module) {
    module.exports = require('jquery');
});

@sorrycc
Copy link
Member Author

sorrycc commented Jun 19, 2014

@airyland 可以试下 build 时 ignore 调 jquery,然后在页面上通过 seajs 设置 alias 指定 jquery 版本。

@popomore
Copy link
Member

这个如果提醒的话可以放 spm 做

var file = pkg.files[pkg.main], dup = [];
var files = file.lookup(function(fileInfo) {
  // 不区分版本
  var filepath = fileInfo.pkg.name + '/' + fileInfo.filepath;
  // 如果不重复,则忽略
  if (dup.indexOf(filepath) === -1) {
    dup.push(filepath);
    return false;
  }
  return fileInfo;
});
if (files.length) {
  console.warn('重复')
}

@popomore popomore added the build label Jul 14, 2014
@popomore popomore added this to the 3.1 milestone Jul 16, 2014
@sorrycc sorrycc closed this as completed Jul 22, 2014
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