I'm working on a web-app, for which I use the google closure compiler with gulp. Here is my gulp-script:
const gulp = require('gulp');
const closureCompiler = require('google-closure-compiler').gulp();
const sourcemaps = require('gulp-sourcemaps');
const sourceFiles = [
'./src/**.js',
'./src/**/*.js',
'!./src/**.test.js',
'!./src/**/*.test.js'
];
gulp.task('minify', (done) => {
gulp
.src(sourceFiles)
.pipe(
closureCompiler({
compilation_level: 'ADVANCED_OPTIMIZATIONS',
warning_level: 'VERBOSE',
js_output_file: 'gameshow.min.js',
dependency_mode: 'PRUNE',
entry_point: './gameshow',
formatting: 'PRETTY_PRINT'
})
)
.pipe(sourcemaps.write('/'))
.pipe(gulp.dest('./dist'));
done();
});
Whenever i have an error in my code (e.g. wrong import path) the closure compiler seems to crash after it prints the warnings and error messages. But then I get this:
[10:07:58] Using gulpfile C:\WorkSpace\gameshow\gulpfile.js
[10:07:58] Starting 'minify'...
[10:07:58] Finished 'minify' after 16 ms
gulp-google-closure-compiler: message/mainmessagemanager.js:40:5: WARNING - [JSC_BAD_JSDOC_ANNOTATION] Parse error. illegal use of unknown JSDoc tag "listens"; ignoring it. Place another character before the @ to stop JSCompiler from parsing it as an annotation.
40| * @listens ViewManager#new-view
^
message/messagemanager.js:20:5: WARNING - [JSC_BAD_JSDOC_ANNOTATION] Parse error. illegal use
of unknown JSDoc tag "listens"; ignoring it. Place another character before the @ to stop JSCompiler from parsing it as an annotation.
20| * @listens Observable#observable-update
^
data/team.js:39:59: ERROR - [JSC_UNDEFINED_VARIABLE] variable Game is undeclared
39| this.teamName = new Observable(`team.${id}.team name`, Game.TeamsOrPlayers.getValue() ? `Team ${id}` : `Player ${id}`);
^^^^
1 error(s), 2 warning(s)
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
CustomError: Error in gulp-google-closure-compiler
at C:\WorkSpace\gameshow\node_modules\google-closure-compiler\lib\gulp\index.js:211:28
Error: gulp-google-closure-compiler: Compilation errors occurred
at CompilationStream._compilationComplete (C:\WorkSpace\gameshow\node_modules\google-closure-compiler\lib\gulp\index.js:238:28)
at C:\WorkSpace\gameshow\node_modules\google-closure-compiler\lib\gulp\index.js:208:14
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Domain instance at:
at CompilationStream.emit (node:domain:540:12)
at C:\WorkSpace\gameshow\node_modules\google-closure-compiler\lib\gulp\index.js:211:14
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
original: CustomError: gulp-google-closure-compiler: Compilation errors occurred
at CompilationStream._compilationComplete (C:\WorkSpace\gameshow\node_modules\google-closure-compiler\lib\gulp\index.js:238:28)
at C:\WorkSpace\gameshow\node_modules\google-closure-compiler\lib\gulp\index.js:208:14
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
domainEmitter: CompilationStream {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [
DestroyableTransform {
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: true,
_transformState: [Object],
_destroyed: false,
_transform: [Function: sourceMapWrite],
[Symbol(kCapture)]: false
}
],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
end: [Function: bound onceWrapper] { listener: [Function: onend] },
data: [Function: ondata]
},
_eventsCount: 3,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: true,
highWaterMark: 16,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
compilationOptions_: {
compilation_level: 'ADVANCED_OPTIMIZATIONS',
warning_level: 'VERBOSE',
js_output_file: 'gameshow.min.js',
dependency_mode: 'PRUNE',
entry_point: './gameshow',
formatting: 'PRETTY_PRINT'
},
streamMode_: 'BOTH',
logger_: Object [console] {
log: [Function: log],
warn: [Function: warn],
dir: [Function: dir],
time: [Function: time],
timeEnd: [Function: timeEnd],
timeLog: [Function: timeLog],
trace: [Function: trace],
assert: [Function: assert],
clear: [Function: clear],
count: [Function: count],
countReset: [Function: countReset],
group: [Function: group],
groupEnd: [Function: groupEnd],
table: [Function: table],
debug: [Function: debug],
info: [Function: info],
dirxml: [Function: dirxml],
error: [Function: error],
groupCollapsed: [Function: groupCollapsed],
Console: [Function: Console],
profile: [Function: profile],
profileEnd: [Function: profileEnd],
timeStamp: [Function: timeStamp],
context: [Function: context],
createTask: [Function: createTask]
},
PLUGIN_NAME_: 'gulp-google-closure-compiler',
fileList_: [
File {
stat: Stats {
dev: 1946988696,
mode: 33206,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
blksize: 4096,
ino: 8725724278860352,
size: 527,
blocks: 8,
atimeMs: 1686297160464.599,
mtimeMs: 1686076160031.9421,
ctimeMs: 1686076160031.9421,
birthtimeMs: 1680796196520.1814,
atime: 2023-06-09T07:52:40.465Z,
mtime: 2023-06-06T18:29:20.032Z,
ctime: 2023-06-06T18:29:20.032Z,
birthtime: 2023-04-06T15:49:56.520Z
},
_contents: Buffer(527) [Uint8Array] [
105, 109, 112, 111, 114, 116, 32, 77, 97, 105, 110, 77,
101, 115, 115, 97, 103, 101, 77, 101, 115, 115, 101, 110,
103, 101, 114, 32, 102, 114, 111, 109, 32, 39, 46, 47,
109, 101, 115, 115, 97, 103, 101, 47, 109, 97, 105, 110,
109, 101, 115, 115, 97, 103, 101, 109, 97, 110, 97, 103,
101, 114, 46, 106, 115, 39, 59, 32, 47, 47, 101, 115,
108, 105, 110, 116, 45, 100, 105, 115, 97, 98, 108, 101,
45, 108, 105, 110, 101, 13, 10, 105, 109, 112, 111, 114,
116, 32, 77, 111,
... 427 more items
],
history: [ 'C:\\WorkSpace\\gameshow\\src\\gameshow.js' ],
_cwd: 'C:\\WorkSpace\\gameshow',
_base: 'C:\\WorkSpace\\gameshow\\src',
_isVinyl: true,
_symlink: null
},
File {
stat: Stats {
dev: 1946988696,
mode: 33206,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
blksize: 4096,
ino: 1407374885448112,
size: 3068,
blocks: 8,
atimeMs: 1686297160473.5981,
mtimeMs: 1681546512408.303,
ctimeMs: 1681546512408.303,
birthtimeMs: 1678619944149.8179,
atime: 2023-06-09T07:52:40.474Z,
mtime: 2023-04-15T08:15:12.408Z,
ctime: 2023-04-15T08:15:12.408Z,
birthtime: 2023-03-12T11:19:04.150Z
},
_contents: Buffer(3068) [Uint8Array] [
105, 109, 112, 111, 114, 116, 32, 77, 111, 100, 83, 99,
114, 101, 101, 110, 77, 97, 110, 97, 103, 101, 114, 32,
102, 114, 111, 109, 32, 39, 46, 47, 109, 111, 100, 47,
109, 111, 100, 115, 99, 114, 101, 101, 110, 109, 97, 110,
97, 103, 101, 114, 46, 106, 115, 39, 59, 13, 10, 13,
10, 47, 42, 42, 13, 10, 32, 42, 32, 65, 32, 71,
97, 109, 101, 32, 111, 102, 32, 79, 114, 100, 110, 117,
110, 103, 115, 104, 117, 101, 116, 101, 114, 46, 13, 10,
32, 42, 13, 10,
... 2968 more items
],
history: [ 'C:\\WorkSpace\\gameshow\\src\\oh.js' ],
_cwd: 'C:\\WorkSpace\\gameshow',
_base: 'C:\\WorkSpace\\gameshow\\src',
_isVinyl: true,
_symlink: null
},
File {
stat: Stats {
dev: 1946988696,
mode: 33206,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
blksize: 4096,
ino: 360850920143085000,
size: 2429,
blocks: 8,
atimeMs: 1686297160474.6038,
mtimeMs: 1686076226349.0198,
ctimeMs: 1686076226349.0198,
birthtimeMs: 1686062037711.4128,
atime: 2023-06-09T07:52:40.475Z,
mtime: 2023-06-06T18:30:26.349Z,
ctime: 2023-06-06T18:30:26.349Z,
birthtime: 2023-06-06T14:33:57.711Z
},
_contents: Buffer(2429) [Uint8Array] [
47, 42, 42, 13, 10, 32, 42, 32, 64, 102, 105, 108,
101, 111, 118, 101, 114, 118, 105, 101, 119, 32, 84, 104,
105, 115, 32, 102, 105, 108, 101, 32, 99, 111, 110, 116,
97, 105, 110, 115, 32, 116, 104, 101, 32, 105, 109, 112,
108, 101, 109, 101, 110, 116, 97, 116, 105, 111, 110, 32,
111, 102, 32, 116, 104, 101, 32, 115, 105, 110, 103, 108,
101, 116, 111, 110, 32, 99, 108, 97, 115, 115, 32, 123,
64, 108, 105, 110, 107, 32, 68, 97, 116, 97, 82, 101,
103, 105, 115, 116,
... 2329 more items
],
history: [
'C:\\WorkSpace\\gameshow\\src\\container\\dataregistry.js'
],
_cwd: 'C:\\WorkSpace\\gameshow',
_base: 'C:\\WorkSpace\\gameshow\\src',
_isVinyl: true,
_symlink: null
},
File {
stat: Stats {
dev: 1946988696,
mode: 33206,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
blksize: 4096,
ino: 2251799815609043,
size: 1025,
blocks: 8,
atimeMs: 1686297160474.6038,
mtimeMs: 1684851833757.3774,
ctimeMs: 1686126485624.8916,
birthtimeMs: 1684851173573.0974,
atime: 2023-06-09T07:52:40.475Z,
mtime: 2023-05-23T14:23:53.757Z,
ctime: 2023-06-07T08:28:05.625Z,
birthtime: 2023-05-23T14:12:53.573Z
},
_contents: Buffer(1025) [Uint8Array] [
47, 42, 42, 13, 10, 32, 42, 32, 64, 102, 105, 108,
101, 111, 118, 101, 114, 118, 105, 101, 119, 32, 84, 104,
105, 115, 32, 102, 105, 108, 101, 32, 99, 111, 110, 116,
97, 105, 110, 115, 32, 116, 104, 101, 32, 105, 109, 112,
108, 101, 109, 101, 110, 116, 97, 116, 105, 111, 110, 32,
111, 102, 32, 116, 104, 101, 32, 97, 98, 115, 116, 114,
97, 99, 116, 32, 99, 108, 97, 115, 115, 32, 123, 64,
108, 105, 110, 107, 32, 79, 98, 115, 101, 114, 118, 97,
98, 108, 101, 73,
... 925 more items
],
history: [
'C:\\WorkSpace\\gameshow\\src\\container\\observableinfo.js'
],
_cwd: 'C:\\WorkSpace\\gameshow',
_base: 'C:\\WorkSpace\\gameshow\\src',
_isVinyl: true,
_symlink: null
},
File {
stat: Stats {
dev: 1946988696,
mode: 33206,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
blksize: 4096,
ino: 259801403503951070,
size: 759,
blocks: 8,
atimeMs: 1686297160476.6,
mtimeMs: 1683903315796.5876,
ctimeMs: 1683903315796.5876,
birthtimeMs: 1679318688314.783,
atime: 2023-06-09T07:52:40.477Z,
mtime: 2023-05-12T14:55:15.797Z,
ctime: 2023-05-12T14:55:15.797Z,
birthtime: 2023-03-20T13:24:48.315Z
},
_contents: Buffer(759) [Uint8Array] [
47, 42, 42, 13, 10, 32, 42, 32, 64, 102, 105, 108,
101, 111, 118, 101, 114, 118, 105, 101, 119, 32, 84, 104,
105, 115, 32, 102, 105, 108, 101, 32, 99, 111
This is just the very beginning of the error dump. It's over 4000!!! lines long. I believe that this comes from Nodejs, but I haven't found a way to suppress this message. I'm not asking about why my code crashes. Rather I don't want to have to open a new terminal each time i call the closure compiler or search for the few lines of useful information in the 4000 lines per call.
- Node.js v19.4.0
- [email protected]
- [email protected]