My website project has a few JavaScript library dependencies, and I am using the gulp-concat plugin in my gulpfile.js to bundle them as one library instead of including them separately:
gulp.src(['src/js/angular.min.js',
'src/js/angular-route.min.js',
'src/js/angular-sanitize.min.js',
'src/js/domador.min.js',
'src/js/megamark.min.js',
'src/js/woofmark.min.js'])
.pipe(concat('libs.js'))
.pipe(gulp.dest('dist/'));
A problem was introduced once I added the domador, megamark and woofmark libraries.
Although these libraries work perfectly fine if referenced in the HTML separately, bundling them introduces some illegal characters into my libs.js which breaks Chrome:
Uncaught SyntaxError: Unexpected token ILLEGAL
Dev Tools shows me that there are indeed three unexpected characters in-between where megamark.min.js finishes and woofmark.min.js starts:
But! When I look at libs.js in Visual Studio:
There seems to be some kind of 'hidden' characters in the mix which become 'unhidden' to Chrome and kill the script. I don't understand why they are there or why none of things I've tried to remedy it are working...
What I have tried:
- Bundle everything except
woofmark.min.jsand include that separately. Yes, this works, but I want to bundle them all (and I want to understand what is happening) - Re-saved the files in Notepad as UTF-8 encoding. No effect.
- Backspaced from half-way through the first keyword in
woofmark.min.js, many more times than necessary, then re-typed the necessary characters. No effect. - Similar effort for the last few characters of
megamark.min.js. No effect.
Any insight would be greatly appreciated!

