".js" file generated by Gulp returns the error "require is not defined"

1

I've installed Gulp to concatenate and mine my files .js , but the following error occurs in the browser when I test the application:

Uncaught ReferenceError: require is not defined

I have gulpfile.js as follows:

var gulp = require('gulp');
var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var uglifycss = require('gulp-uglifycss');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('js', function () {
    return gulp.src([
        'node_modules/jquery/dist/jquery.min.js',
        'node_modules/jquery-ui/jquery-ui.js',
        'node_modules/bootstrap/dist/js/bootstrap.min.js',
        'node_modules/amcharts3/amcharts/amcharts.js',
        'node_modules/amcharts3/amcharts/serial.js',
        'node_modules/amcharts3/amcharts/pie.js',
        'src/Havas/AdminBundle/Resources/public/js/chart.js',
        'src/Havas/AdminBundle/Resources/public/js/map.js',
        'src/Havas/AdminBundle/Resources/public/js/jquery-jvectormap-1.2.2/jquery-jvectormap-1.2.2.min.js',
        'src/Havas/AdminBundle/Resources/public/js/jquery-jvectormap-1.2.2/jquery-jvectormap-us-aea-en.js',
        'src/Havas/AdminBundle/Resources/public/js/main.js'
    ])
    .pipe(concat('javascript.js'))
    .pipe(uglify())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('web/js'));
});

gulp.task('default', ['js']);

How to correct this error? What did I do wrong?

    
asked by anonymous 13.04.2016 / 20:29

0 answers