amd-optimize
amd-optimize copied to clipboard
define is not defined
Getting a define is not defined error.
Gulp:
return gulp.src('src/assets/js/*/') // Traces all modules and outputs them in the correct order. .pipe(amdOptimize("app", { paths : { "jquery" : "./bower_components/jquery/dist/jquery" } })) .pipe(concat("app.min.js")) .pipe(gulp.dest('build/assets/js/build'));
app.js
require([ 'globals' ],function(){});
globals.js
define(['jquery'], function($) { 'use strict';
console.log('hello');
});
Hi there, I think you will need to add a RequireJS runtime to your build. Either the full RequireJS or Almond.
Thanks for the quick reply.
I have my script tag as script data-main="/assets/js/build/app.min.js" src="/assets/js/build/require.js"
Get error: Uncaught ReferenceError: /assets/js/build/app.min.js: define is not defined
Did you solve the problem? if so, how could you do that?