-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
internal-issue-createdAn internal Google issue has been created to track this GitHub issueAn internal Google issue has been created to track this GitHub issuetriage-doneHas been reviewed by someone on triage rotation.Has been reviewed by someone on triage rotation.
Description
java -jar closure-compiler-v20191027.jar --version
Closure Compiler (http://github.com/google/closure-compiler)
Version: v20191027
Built on: 2019-10-30 03:56
Came across this when running closure compiler on core-js, caused by this file: zloirock/core-js/internal-metadata.js. It contains a module.exports
assignment within a compound assignment (see at the bottom).
Possibly related to #3093 ?
Minimal example that reproduces this:
// /tmp/export-wrong.js
var exp = () => {};
var meta = module.exports = {exp: exp}
This currently compiles to:
java -jar closure-compiler-v20191027.jar --process_common_js_modules=true --entry_point=/tmp/exports-wrong.js --compilation_level=SIMPLE_OPTIMIZATIONS --js /tmp/exports-wrong.js
var module$tmp$exports_wrong={default:{}};
module$tmp$exports_wrong.default.exp=function(){};
var meta$$module$tmp$exports_wrong=module$tmp$exports_wrong.default={exp:exp};
Are these kind of exports supported? When this code is run, exp
will be undefined. It works correctly when changing the export to a top-level assignment statement:
var exp = () => {};
var meta = {exp: exp};
module.exports = meta;
Metadata
Metadata
Assignees
Labels
internal-issue-createdAn internal Google issue has been created to track this GitHub issueAn internal Google issue has been created to track this GitHub issuetriage-doneHas been reviewed by someone on triage rotation.Has been reviewed by someone on triage rotation.