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

spm3.x,spm build后为什么在合并后的js里面看不到jquery #75

Open
Frey1991 opened this issue Mar 27, 2015 · 1 comment
Open

Comments

@Frey1991
Copy link

文件结构如下:
/app/index.html

/static/js/main.js
/static/js/test.js

/spm_modules/jquery/2.1.3/jquery.js
/spm_modules/seajs/2.3.0/dist/sea-debug.js

配置如下:
【/app/index.html 】
seajs.config({
base: '../',
alias: {
'jquery': 'spm_modules/jquery/2.1.3/jquery.js'
}
});

// seajs.use('../static/js/main');
seajs.use('dist/test-build/0.0.0/static/js/main-debug.js', 'jquery');

【main.js 】
var $ = require('../../spm_modules/jquery/2.1.3/jquery');
var Test = require('./test');

$(function(){
var test = new Test($('.test'));
test.init();
});

【test.js】
var $ = require('../../spm_modules/jquery/2.1.3/jquery');

function Test(divs){
this.divs = divs;
this.bgColor = '#0ff';
}

Test.prototype.init = function(){
this.setBgColor();
};

Test.prototype.setBgColor = function(){
this.divs.each(function(i){
var self = $(this);
setTimeout(function(){
self.addClass('active');
}, i * 200);
});
};

module.exports = Test;

build后运行不了,望解答!

@afc163
Copy link
Member

afc163 commented Mar 29, 2015

建议按照官方文档走一遍:http://spmjs.io/documentation/develop-a-package

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

No branches or pull requests

2 participants