比如有如下结构
--project
----index
------index.js
----show
------show.js
------task_chart.js
其中show.js里面代码如下:
var say = require('./task_chart');
say.hello();
showRequired.js代码如下
function hello(){
alert('hello')
}
module.exports.hello = hello;
gulpfile.js如下:
gulp.task( 'browserify', function() {
return gulp.src( [ 'project/**/*.js' ] )
.pipe( browserify( {
} ) )
.pipe( gulp.dest( './WebContent/public/js/' ) )
但是运行gulp的时候会出错,如下:
events.js:141
throw er; // Unhandled 'error' event
^
Error: module "./task_chart" not found from "D:\work\projectName\WebContent\project\co.........................
但是单独压缩show这个文件夹确是可以的
gulp.task( 'browserify', function() {
return gulp.src( [ 'project/show/*.js' ] )
.pipe( browserify( {
} ) )
.pipe( gulp.dest( './WebContent/public/js/' ) )
这个是什么原因
module.exports 不是gulp的吧 还用了什么
webpack??