google / google/closure-compiler

Module not added to compiled JavaScript file when import declaration inside ES6 module contains line breaks inside curly braces

Open
#2,797 2 comments 0 reactions 1 assignee Claimed by @shicks View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

When a JavaScript module contains the following import:

```
import {
ExportedVariable
} from "/assets/js/target-module.js";
```

target-module.js is not included in compiled JS, though its name is used in the compiled JS file. When the import declaration is written in single line:

`import { ExportedVariable } from "/assets/js/target-module.js";`

everything works fine.

Tested with revisions v20180101 and v20171023.

JS compilation started from Gradle, Java 8, using direct call of com.google.javascript.jscomp.CommandLineRunner class with the following arguments:

--logging_level=INFO
--warning_level=DEFAULT
--jscomp_warning=*
--language_in=ECMASCRIPT_2017
--language_out=ECMASCRIPT5
--compilation_level=SIMPLE_OPTIMIZATIONS
--create_source_map=build/main.js.map
--source_map_location_mapping=./src/assets/js/|./src/
--module_resolution=BROWSER
--dependency_mode=STRICT
--js_module_root=src/
--js=src/assets/js/**/*.js
--entry_point=src/assets/js/main
--js_output_file=build/main.js

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.