2

As far as i know the newest Closure Compiler supports three types of modules: ES6, CommonJS and goog.module(). How can i use the Nodejs internal modules?

I have this very simple code:

const path = require('path');

And this compiler flags, among others:

--dependency_mode STRICT
--env CUSTOM (without this fails as well)
--externs nodejs/path.js
--language_in ECMASCRIPT6_STRICT
--language_out ECMASCRIPT5_STRICT
--new_type_inf
--process_common_js_modules
--use_types_for_optimization

And the compiler throws:

ERROR - Failed to load module "path"

Any hints? Many thanks in advance.

0 Answers0