Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const_modules not handling object shorthand references properly #7021

Closed
magic-akari opened this issue Mar 6, 2023 · 1 comment · Fixed by #7022
Closed

const_modules not handling object shorthand references properly #7021

magic-akari opened this issue Mar 6, 2023 · 1 comment · Fixed by #7022
Labels
Milestone

Comments

@magic-akari
Copy link
Member

Describe the bug

I have previously encountered a similar issue with modules transpilation and was able to resolve it using similar handling methods.

Input code

import { bar } from 'foo';
console.log({ bar });

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript"
    },
    "transform": {
      "constModules": {
        "globals": {
          "foo": {
            "bar": "true"
          }
        }
      }
    },
    "target": "es5",
    "loose": false
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}

Playground link

https://play.swc.rs/?version=1.3.38&code=H4sIAAAAAAAAA8vMLcgvKlGoVkhKLFKoVUgrys9VUE%2FLz1e35krOzyvOz0nVy8lP14DKa1oDAAwm73IwAAAA&config=H4sIAAAAAAAAAy2NQQ7EIAhF78La7czCO%2FQQ1MHGiYoBm4xpevcRUzZAeP9xwVcD%2BAsaipLYpKN2%2FIEHCgU1SGodbgddsGpkKcYErto3%2FpyZ1PYj8455jZHZ2o5TNkMnwT1r5lEO6qbVFzjIzErg40zRvJblsmAfjRb1tq8l1RTHwzlIuj2gme8%2FnocnU74AAAA%3D

Expected behavior

console.log({
    bar: true
});

Actual behavior

console.log({
    bar: bar
});

Version

1.3.38

Additional context

No response

@swc-bot
Copy link
Collaborator

swc-bot commented Apr 9, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants