Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import uberCompiler from 'uber-compiler';
✗ const uberCompiler = require('uber-compiler');
The package exports a factory function directly; ESM import as default works, but CommonJS require also works.
uberCompiler function
✓ import uberCompiler from 'uber-compiler'; const compiler = uberCompiler(options);
✗ const { uberCompiler } = require('uber-compiler');
The package exports a single function; named destructuring fails.
getJsFilename
✓ import uberCompiler from 'uber-compiler'; const compiler = uberCompiler(options); const jsFile = compiler.getJsFilename();
✗ import { getJsFilename } from 'uber-compiler';
Methods are available on the compiler instance, not exported directly from the package.
Creates an uber-compiler instance with JS and CSS paths, then compiles and watches for changes.
const path = require('path');
const uberCompiler = require('uber-compiler');
const rootPath = process.cwd();
const options = {
jsPaths: [
path.join(rootPath, 'public/js/lib/jquery-1.7.2.js'),
path.join(rootPath, 'public/js/lib/underscore.js'),
path.join(rootPath, 'public/js/lib/backbone.js'),
path.join(rootPath, 'public/js/init.js'),
path.join(rootPath, 'public/js/model/'),
path.join(rootPath, 'public/js/view/'),
path.join(rootPath, 'public/js/router/'),
path.join(rootPath, 'public/js/main.js')
],
cssPaths: [ path.join(rootPath, 'public/css') ],
outputDir: path.join(rootPath, 'public/cached'),
debug: false
};
const compiler = uberCompiler(options);
compiler.run();
Errors
Common errors & fixes
Error: Path must be absolute: relative/path/to/js
Providing relative paths in jsPaths or cssPaths.
fixUse absolute paths by prefixing with path.join(__dirname, ...) or path.resolve().
Error: Cannot find module 'google-closure-compiler'
Missing google-closure-compiler dependency, which must be installed globally.
fixRun: npm i -g google-closure-compiler
ReferenceError: require is not defined
Attempting to use CommonJS require in an ESM module file.
fixUse import uberCompiler from 'uber-compiler'; instead, or rename file to .cjs.
Audit
Dependencies
google-closure-compilerrequiredRequired for JS compilation via Google Closure Compiler.