Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

217
Vistas
require is not defined error on gulp-concat

I want to uglify and combine my js files with gulp. Here is my code

var gulp = require('gulp');
var uglify = require('gulp-uglify');
var pump = require('pump');
var gutil = require('gulp-util');
gutil.env.type = 'production';
gulp.task('uglify', function (cb) {
return gulp.src([
    'pure/modernizr.js',
    'pure/horizon.js'
])
        .pipe(gutil.env.type === 'production' ? uglify() : gutil.noop())
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest("ugly"));
});
var sourcemaps = require("gulp-sourcemaps");
var concat = require("gulp-concat-js");
gulp.task("concat", function () {
return gulp.src([
    'ugly/modernizr.js',
    'ugly/horizon.js'
])
        .pipe(sourcemaps.init())
        .pipe(concat({
            "target": "concatenated.js", // Name to concatenate to 
            "entry": "./main.js" // Entrypoint for the application, main module 
                    // The `./` part is important! The path is relative to 
                    // whatever gulp decides is the base-path, in this 
                    // example that is `./lib` 
        }))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest("pure/"));
});

I end up with some code enclosing my js files from obfuscator stating:

//// THIS FILE IS CONCATENATED WITH gulp-obfuscator-js

When I include this in code, it throws require is not defined, I surf around the web and found one similar question. But that answer is also not clear for me. I believe that I miss some small thing here, since I am new to gulp.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The issue here is I have used gulp-concat-js which obfuscate your js. I should have used gulp-concat. May help someone.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda