Skip to content

Commit

Permalink
add externs to remove disabled warning
Browse files Browse the repository at this point in the history
  • Loading branch information
samthor committed Mar 8, 2018
1 parent c3a66c2 commit 9c72079
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ const closureCompiler = new ClosureCompiler({
js: './src/*.js',
entry_point: './src/index.js',
js_output_file: './proxy.min.js',
language_in: 'ECMASCRIPT6',
language_in: 'ECMASCRIPT6_STRICT',
language_out: 'ECMASCRIPT5',
compilation_level: 'ADVANCED_OPTIMIZATIONS',
dependency_mode: 'STRICT',
warning_level: 'VERBOSE',
process_common_js_modules: true,
output_wrapper: '(function(){%output%})()', // this prevents closure compiler from polluting the global scope
jscomp_off: 'undefinedVars', // `global` and `process` are not defined...
});

const compilerProcess = closureCompiler.run((code, stdout, stderr) => {
if (stderr) {
console.error('err!', stdErr);
console.error('err!', stderr);
return;
}
console.log('done!');
console.log('done!', stdout);
});
30 changes: 30 additions & 0 deletions src/externs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

/**
* @externs
* @fileoverview Externs so that Closure doesn't complain about environment checks.
*/

/**
* @type {Object}
*/
var process;

/**
* @type {Object}
*/
var global;

0 comments on commit 9c72079

Please sign in to comment.