Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
Grunt no "requiere" archivos JavaScript de todas las carpetas en la ruta al crear el archivo de destino

Tengo una fuente con muchos archivos y estoy generando un solo archivo como archivo de destino, sin embargo, cuando se genera el archivo, no requiere algunos archivos js que se encuentran en la ruta

El archivo que debe solicitarse se encuentra en src/components/employees/index.js .

Su contenido:

 module.exports = { IncludeMe: 'Some-Payload-Goes-Here......' }

El archivo main.js :

 const employeesData = require('src/components/employees') const getEmployeeData = (... .... ....) => { try { ... ... // Data manipulations ... return { ...employeesData }; } catch (err) { return err; } } module.exports = getEmployeeData;

Y este es el GruntFile

 module.exports = (grunt) => { grunt.initConfig({ 'string-replace': { dist: { files: { 'output/': [ 'src/**/*.js', 'main.js', '!src/**/*.test.js', '!src/**/index.js', ], }, options: { replacements: [{ pattern: /module\.exports[\s]?=[\s]?([a-zA-Z0-9,\{\}\s]+)\;/ig, replacement: '' }, { pattern: /const[\s]?([a-zA-Z0-9\{\}\s\,]+)[\s]?=[\s]?require\(([a-zA-Z0-9.\/\\\']+)\)\;/ig, replacement: '' }] } } }, uglify: { prod: { files: { 'output/main.js': ['output/src/**/*.js', 'output/main.js'] }, options: { report: true, preserveComments: false, compress: true, beautify: true }, }, }, clean: ['output/src/', 'output/main.js'] }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-string-replace'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.registerTask('default', ['string-replace', 'uglify', 'clean']); };

El archivo generado tiene el siguiente aspecto:

 try { var u = { ...u = {}, ...employeesData }; return Object.keys(u).length ? u : {}; } catch (r) { }

Tenga en cuenta que no pone el contenido de employeesData .

Algúna idea de cómo arreglar esto ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!