swc icon indicating copy to clipboard operation
swc copied to clipboard

wrong export name when targeting SystemJS

Open magic-akari opened this issue 1 year ago • 0 comments

Describe the bug

x should be exported as y

Input code

import x from "./x";
export { x as y };

Config

{
  "$schema": "https://json.schemastore.org/swcrc",
  "jsc": {
    "parser": {
      "syntax": "ecmascript"
    },
    "target": "es2022"
  },
  "isModule": true,
  "module": {
    "type": "systemjs"
  }
}

Playground link

https://play.swc.rs/?version=1.2.244&code=H4sIAAAAAAAAA8vMLcgvKlGoUEgrys9VUNLTr1Cy5kqtAAtWA4UTixUqFWqtAeRK2oQnAAAA&config=H4sIAAAAAAAAAy2MUQrDIBBE7zL0U2Lx0zv0EGKXJFKj7G5og3j3Ku3XzDxmpuEmcaMc4LGpVvHWJinH8qOihWkpvFp5R44wSBLhG2pgIZ5OrkPDZ8wpjn7kvSq6gQZeSScWd3duol0e5Xm%2BCF75JIP8Tw161aHjSpRyEvT%2BBaWDL2OYAAAA

Expected behavior

x should be exported as y

Actual behavior

System.register([
    "./x"
], function(_export, _context) {
    "use strict";
    var x;
    return {
        setters: [
            function(_x) {
                x = _x.default;
            }
        ],
        execute: function() {
            _export("x", y);
        }
    };
});

Version

1.2.244

Additional context

No response

magic-akari avatar Aug 27 '22 17:08 magic-akari