Tuesday, 15 January 2013

JavaScript - Gulp/Browserify: SyntaxError: Unexpected token -


For any reason, my browserify and bulk stop working For example, here's my Gulppan JS script is my javascript bundle.

  gulp.task ('js', function () {gulp.src (' src / js / .js') .pipe (plumber ()) .Pipe (gulp.dest (' Js')); Browser Browsing Back ('. / Src / js / main', {debug: true}). Bundle () pipe (source ('bundle .js')) * * .pip (streammove (euglly) ) ./pip (gulp.dest ('.')) .pip (notify ({message: 'javascript is bundled with browserify!'})) // pipe (liveload ()) ;});  

and here main.js :

  var ajaxChng = ('. Ajax-changelog'); AjaxChng ();  

and inside src / js / ajax-changelog.js this is:

  module.exports = {console.log ('Hello world'); };  

But when I do Gulp js , I get:

  λ GLP JS [19:11:50 ] Using the FalseFile C: \ wamp \ www \ osrsmap \ gulpfile.js [19:11] is starting 'js' ... events.js: 85 Throwing Er; // Unwanted 'error' event ^ syntax error: unexpected token  

... am I doing wrong?

Wait ... this is not a valid JavaScript:

  module .exports = {console.log ('Hello World'); };  

Maybe you mean it?

  module.exports = function () {console.log ('Hello World'); };  

No comments:

Post a Comment