I am using Nodejs- v12.9.0 & gulp-4.0.2
I want to concatenate & minify multiple js files from different src directories and bundle then into a single JS file.
It does concatenate, minify & generates a single js file.
While running this generated js file it gives below error because in almost all the js files we have this module const fs = require('fs').
const fs = require('fs');
Getting below error
SyntaxError: Identifier 'fs' has already been declared
gulp task:
function copyOtherJs(){
return src(['main.js','app.js', 'src/*.js'])
.pipe(terser({ parse: { bare_returns: false}, mangle: false }))//{ parse: { bare_returns: true }
.pipe(concat('srcJs.js'))
.pipe(dest('dist/src'));
}
How to overcome this error while running my minified js file.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…