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

after compiled: export keyword “char” has been replaced like "_char", but import still use "char" #7237

Closed
yangaihe opened this issue Apr 10, 2023 · 9 comments · Fixed by #7251
Assignees
Labels
Milestone

Comments

@yangaihe
Copy link

Describe the bug

"@swc/core": "1.3.49"

example

test.js
export function char() { console.log("char====char"); return ""; }

util.js
import { char } from "./test"; char();

complied code:

`"use strict";
webpack_require.r(webpack_exports);
/* harmony export / webpack_require.d(webpack_exports, {
/
harmony export / "_char": () => (/ binding / _char)
/
harmony export */ });
function _char() {
console.log("char====char");
return "";
}

"use strict";
webpack_require.r(webpack_exports);
/* harmony export / webpack_require.d(webpack_exports, {
/
harmony export / });
/
harmony import */ var test__WEBPACK_IMPORTED_MODULE_0_ = webpack_require("./src/test.js");

(0,test__WEBPACK_IMPORTED_MODULE_0_.char)();
`

export keyword “char” has been replaced like "_char", but import still use "char"

Input code

No response

Config

No response

Playground link

No response

Expected behavior

export keyword “char” has been replaced to a new string
import follow the same rule

Actual behavior

No response

Version

1.3.49

Additional context

No response

@yangaihe yangaihe added the C-bug label Apr 10, 2023
@kdy1 kdy1 added this to the Planned milestone Apr 11, 2023
@kdy1
Copy link
Member

kdy1 commented Apr 11, 2023

Please provide a repro. At least a playground link

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2023
@yangaihe
Copy link
Author

@kdy1 this is my test repro
https://github.com/yangaihe/test-swc

by steps, u can see the problem

  1. npm install
  2. npm run start

show develop tools, result like this
image

then u can see complied code

1 similar comment
@yangaihe
Copy link
Author

@kdy1 this is my test repro
https://github.com/yangaihe/test-swc

by steps, u can see the problem

  1. npm install
  2. npm run start

show develop tools, result like this
image

then u can see complied code

@kdy1
Copy link
Member

kdy1 commented Apr 11, 2023

Please provide a minimal repro. It's way too large to analyze

@kdy1 kdy1 reopened this Apr 11, 2023
@kdy1 kdy1 removed this from the Planned milestone Apr 11, 2023
@kdy1
Copy link
Member

kdy1 commented Apr 11, 2023

Investigation: This is a bug of es3 compat pass (likely reserved_words)

@magic-akari
Copy link
Member

It is a missing part of #7165.
Please assign this issue to me.

@kdy1 kdy1 added this to the Planned milestone Apr 11, 2023
@kdy1
Copy link
Member

kdy1 commented Apr 11, 2023

Thank you!

@swc-bot
Copy link
Collaborator

swc-bot commented May 13, 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 May 13, 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.

4 participants