google / google/closure-compiler
Dependency management drops entry points if they export
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
When attempting to compile a module called foo, which imports other relative modules, e.g.:
``` js
import something from "./something";
export function foo(a) {
return something(a * 2);
}
```
using a variation of the following command:
``` bash
java -jar path/to/compiler.jar
--js_module_root=src
--js=src/*.js
--entry_point=src/foo
--language_in=ECMASCRIPT6_STRICT
--language_out=ECMASCRIPT5_STRICT
--generate_exports
--js_output_file=build/foo.js
```
I'm having issues with the export statements defined in the entry point (`src/foo`), the question is: how can those exports be allocated into an object, and exported somehow? Additionally, if using `--assume_function_wrapper`, how can we signal that the exports of the entry point should be allocated into an object of some sort, so they can be returned by the wrapper function.
Ideally, the result of the operation after providing the wrapper will be something along these lines:
``` js
function foo() {
'use strict';
function something$src(n) {
return n + 1;
};
function foo$src(a) {
return something$src(a * 2);
}
return {
foo: foo$src;
};
}
```
As today, if I attempt to add an export statement in the entry point, I get the following error:
```
ERROR - required entry point "src/foo" never provided
```
As you can see, the end-goal is to fold all modules behind the entry point, and export some of the internals (defined in the entry point) so they can be used by the wrapper.
Thoughts?
Contributor guide
Assessment
This issue has not been assessed yet.