google / google/closure-compiler
Incorrect JSC_UNDEFINED_VARIABLE when process_common_js_modules and dependency_mode=NONE
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
```
// a.js
import * as b from './b.js';
console.log(b.x);
```
```
// b.js
const x = /\/*/;
export { x };
```
```
java -jar compiler.jar \
--compilation_level=ADVANCED \
--dependency_mode NONE \
--process_common_js_modules \
--js ./b.js \
--js ./a.js
```
Expected output:
```
console.log(/\/*/);
```
Actual output:
```
./a.js:2:14: ERROR - [JSC_UNDEFINED_VARIABLE] variable x$$module$b is undeclared
2| console.log(b.x);
```
```
compiler.jar --version:
Closure Compiler (http://github.com/google/closure-compiler)
Version: v20210601
```
The following variants work as expected:
```
export const x = /\/*/;
const x = /.*/;
const x = /\//;
import { x } from './b.js';
```
Contributor guide
Assessment
This issue has not been assessed yet.