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 module imports not substituted in exported functions #7747

Closed
rusmisel opened this issue Aug 3, 2023 · 3 comments · Fixed by #7959
Closed

const module imports not substituted in exported functions #7747

rusmisel opened this issue Aug 3, 2023 · 3 comments · Fixed by #7959
Labels
Milestone

Comments

@rusmisel
Copy link

rusmisel commented Aug 3, 2023

Describe the bug

When importing a value from a const module, references to it within an exported function aren't substituted

Input code

import foo from 'some-const-module';
console.log(foo);
export function _() {
  console.log(foo);
}

Config

{ jsc: { constModules: { globals: {
  'some-const-module': { default: '...' }
} } } }

Playground link

No response

Expected behavior

console.log('...');
export function _() {
  console.log('...');
}

Actual behavior

console.log('...');
export function _() {
  console.log(foo);
}

Version

1.3.71

Additional context

No response

@rusmisel rusmisel added the C-bug label Aug 3, 2023
@rusmisel
Copy link
Author

rusmisel commented Aug 3, 2023

(note that non-exported functions are handled correctly)

@rusmisel
Copy link
Author

rusmisel commented Aug 3, 2023

additionally it persists in 1.3.74

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 19, 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 Oct 19, 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