-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
The function inside the closure will be renamed #11136
Comments
If run You may let esbuild keep the function name by // vite.config.js
export default defineConfig({
esbuild: {
keepNames: true
}
}) There is another esbuild REPL for reproduction. |
Ah, I see. Good to know that the function name will be changed by I try to add Not work
Can workIt can work if I use function myFunc() {
function myFunc() {}
Object.defineProperty(myFunc, 'name', { value: 'myFunc' });
return myFunc;
} |
You are right. esbuild There is an early issue(#9164). It discovered the |
Got it. I think it would be better to update the document to mention some of the esbuild configs are disabled. Does Vite has a plan to bring |
+1 on this, vite renames a function in my app, breaking my feature completely. Is there an eta on when this will be re enabled? |
Duplicate of #13727 |
Describe the bug
The internal function will be renamed if its name is same to the external function.
This seems related to the compiler because it won't happen when vite is working with pure javascript.
Can be reproduced with:
Cannot be reproduced with:
Reproduction
https://stackblitz.com/edit/vitejs-vite-7fmv91?file=src/main.ts
Steps to reproduce
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm npmPackages: vite: ^3.2.4 => 3.2.4
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: