Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spm build --include standalone 异常 #71

Closed
hotoo opened this issue Jan 16, 2015 · 4 comments
Closed

spm build --include standalone 异常 #71

hotoo opened this issue Jan 16, 2015 · 4 comments
Labels

Comments

@hotoo
Copy link
Member

hotoo commented Jan 16, 2015

刚开始有些对同一模块的多个版本有依赖

$ spm build
...
      duplicate: jquery (1.11.2,1.7.2) while build $CWD/login.js
      duplicate: moment (2.8.4,2.6.0) while build $CWD/data-5.js
/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertToIIFEDeclaration.js:18
  if (utils.hasExports(node.expression.arguments[2].body)) {
                                                   ^
TypeError: Cannot read property 'body' of undefined
    at Object.module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertToIIFEDeclaration.js:18:52)
    at Object.module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertToFunctionExpression.js:337:37)
    at Object.convertDefinesAndRequires (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertDefinesAndRequires.js:143:42)
    at Controller.estraverse.replace.enter (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/traverseAndUpdateAst.js:53:40)
    at Controller.__execute (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/node_modules/estraverse/estraverse.js:318:31)
    at Controller.replace (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/node_modules/estraverse/estraverse.js:493:27)
    at Object.replace (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/node_modules/estraverse/estraverse.js:561:27)
    at Object.module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/traverseAndUpdateAst.js:24:14)
    at Object.module.exports [as clean] (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/clean.js:77:30)
    at module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/index.js:75:19)
    at DestroyableTransform._transform (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/index.js:14:12)

后来把 jQuery 作为全局变量,并解决了 moment 的多版本依赖问题后,依然有有问题

$ spm build --global jquery:jQuery
...
        package: dependencies: jquery,promise,arale-cookie,linkage,arale-validator,moment,detector,highcharts,bootstrap,arale-calendar,import-style
        package: files: index.js,login.js,data-2.js,global.js,filter.js,data-3.js,data-4.js,data-5.js
         output: files: data-2.js,data-3.js,data-4.js,data-5.js,index.js,login.js
     extra deps: no
/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertToIIFEDeclaration.js:18
  if (utils.hasExports(node.expression.arguments[2].body)) {
                                                   ^
TypeError: Cannot read property 'body' of undefined
    at Object.module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertToIIFEDeclaration.js:18:52)
    at Object.module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertToFunctionExpression.js:337:37)
    at Object.convertDefinesAndRequires (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/convertDefinesAndRequires.js:143:42)
    at Controller.estraverse.replace.enter (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/traverseAndUpdateAst.js:53:40)
    at Controller.__execute (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/node_modules/estraverse/estraverse.js:318:31)
    at Controller.replace (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/node_modules/estraverse/estraverse.js:493:27)
    at Object.replace (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/node_modules/estraverse/estraverse.js:561:27)
    at Object.module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/traverseAndUpdateAst.js:24:14)
    at Object.module.exports [as clean] (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/clean.js:77:30)
    at module.exports (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/node_modules/cmdclean/lib/index.js:75:19)
    at DestroyableTransform._transform (/usr/local/lib/node_modules/spm/node_modules/spm-build/node_modules/gulp-spm/node_modules/spm-standalonify/index.js:14:12)
@sorrycc sorrycc added the bug label Jan 16, 2015
@sorrycc
Copy link
Member

sorrycc commented Jan 16, 2015

是 arale-calendar 依赖 moment 出现的问题,周末我查下具体原因。

@popomore
Copy link
Member

calendar 原来依赖 moment

@hotoo
Copy link
Member Author

hotoo commented Jan 17, 2015

第2个是我在 spm_modules 里把 arale-calendar 的依赖改成了 moment@2.8.4 报的错。

@sorrycc
Copy link
Member

sorrycc commented Jan 17, 2015

moment@2.6.0 ~ moment@2.8.4 都有问题,他中间有一段用了 define('moment', function() {});,少了 deps 数组,standalone 的解析目前不支持这种方式。换成 moment@2.9.0 就好了,我升级下 arale-calendar 的依赖。

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

No branches or pull requests

3 participants