google / closure-compiler-npm

Package for managing and documenting closure-compiler for use via npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug

diricse opened this issue · comments

const compilerPackage = require('google-closure-compiler');
const closureCompiler = compilerPackage.gulp();

gulp.task('js-compile', function () {
return closureCompiler({
js: './src/js/**.js',
externs: compilerPackage.compiler.CONTRIB_PATH + '/externs/jquery-1.9.js',
compilation_level: 'SIMPLE',
warning_level: 'VERBOSE',
language_in: 'ECMASCRIPT6_STRICT',
language_out: 'ECMASCRIPT5_STRICT',
output_wrapper: '(function(){\n%output%\n}).call(this)',
js_output_file: 'output.min.js'
})
.src() // needed to force the plugin to run without gulp.src
.pipe(gulp.dest('./dist/js'));
});

compilerPackage.compiler.CONTRIB_PATH is not right path
the path is node_modules/google-closure-compiler-java/contrib/externs/jquery-1.7.js
but jquery-1.7.js is node_modules/google-closure-compiler/contrib/externs/jquery-1.7.js

this code "const contribPath = path.dirname(path.resolve(__dirname, '../../')) + '/contrib'; " path is wrong in file closure-compiler-js.js
the code "path.dirname(path.resolve(__dirname, '../../'))" result is the path 'node_modules/'

Looks like I didn't account for that when we split the build into multiple packages.