give AMD module a module name if none
$ npm install --save-dev gulp-nam-amd
/***
* views/index.js
**/
define(['base'], function( Baseview ){
"use strict";
......
})
/***
* in gulpfile.js
**/
var nameAmd = require('gulp-name-amd');
...
gulp.src( './views/*.js' ) )
.pipe( nameAmd( ) )
.pipe( gulp.dest( './buld/views' ));
/***
* build/views/index.js
**/
define('index', ['base'], function( Baseview ){
"use strict";
......
})
- DO NOT put code before define([],function(){}) call