petermu / gulp-alias-combo Goto Github PK
View Code? Open in Web Editor NEW一个根据配置合并js文件的gulp插件,合并时会自动提取模块间的依赖
一个根据配置合并js文件的gulp插件,合并时会自动提取模块间的依赖
如代码:
Jslider._setting = {
isAutoPlay: false, //自动播放
animateType: "card",//动画方式card (这一行注释与值没有空格,在gulp的时候会报错)
onslidestart: null, //滑动开始执行的函数
onslideend: null, //滑动结束后执行的函数
isVertical: true, //判断横向还是竖向切换
animateTime: 3000 //播放时间
}
属性 animateType: "card"与后面的注释不存在空格的情况下在gulp的时候会报错,如下错误:
events.js:183
throw er; // Unhandled 'error' event
^
GulpUglifyError: unable to minify JavaScript
这在日常开发中,很难去把控这个注释的空格情况,这是否有办法解决,求大神们给个解决方案,目前使用的是0.3.3版本!
因为0.3.3版本也存在bug所以准备想还原到0.2.7但是还原不回去只还原到0.2.9但这个版本就出现了下面的问题,之前一直用的0.2.7版本是没有任何问题的并且很稳定,但这个版本还原不回去了,这个模块我要弃用了吗??????
报错如下:
F:\devStatic\node_modules\gulp-alias-combo\index.js:28
content = content.replace(commentReg, '')
^
RangeError: Maximum call stack size exceeded
at String.replace ()
at analyseDeps (F:\devStatic\node_modules\gulp-alias-combo\index.js:28:23)
at F:\devStatic\node_modules\gulp-alias-combo\index.js:35:21
at Array.forEach ()
at analyseDeps (F:\devStatic\node_modules\gulp-alias-combo\index.js:31:14)
at F:\devStatic\node_modules\gulp-alias-combo\index.js:35:21
at Array.forEach ()
at analyseDeps (F:\devStatic\node_modules\gulp-alias-combo\index.js:31:14)
at F:\devStatic\node_modules\gulp-alias-combo\index.js:35:21
at Array.forEach ()
我sea模块的代码:
seajs.config({
alias: {
a: "plugin/xx/a.min"
}
});
define(function(require,exports,module){
var a = require(a);
// do something
}
我的gulp配置:
gulp.task("js", function(){
return gulp.src(paths.js)
.pipe(changed(output))
.pipe(aliasCombo({
baseUrl: "scripts/src/",
supportRelative: true
}))
.pipe(uglify())
.pipe(gulp.dest(output));
})
我gulp执行任务的时候,出现找不到js的错误,如下:
[D:\ ........\scripts\src\a.min.js] Not Found
我看了下是路径没对,正确的应该是:
D:\ ........\scripts\src\plugin\xx\a.min.js 这样才对
请问一下,我要怎么配置才行呢?
define(function(require){
gmu.define( 'Dialog', {
options: {}
})
})
会变成这样的 导致不可用,最后会被替换为(gmu-dialog是取得路径别名)
define('gmu-dialog', function(require){
gmu.define('gmu-dialog', 'Dialog', {
options: {}
})
})
有什么解决方案吗,大神求助。。。
Is there a plan to add support for sourcemap file?
如果我请求的是一个相对路径,不合并的时候,请求路径变成了baseUrl+dialog.css的形式,实际上这个文件是和目前js同一个目录
define(function(require){
require("./dialog.css");
})
需要写成相对于baseUrl路径才正确
require("gmu/dialog/src/dialog.css");
如果能同目录解析就好了😁~~
项目中,我每个web模块的 css 都是 require的,这个情况怎么提取css。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.