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

dropLabels unexpected behaviour #3311

Closed
Inqnuam opened this issue Aug 13, 2023 · 2 comments
Closed

dropLabels unexpected behaviour #3311

Inqnuam opened this issue Aug 13, 2023 · 2 comments

Comments

@Inqnuam
Copy link

Inqnuam commented Aug 13, 2023

dropLabels + bundle + default export produces invalid output

{
  dropLabels: ['DROP'],
  format: "esm",
  bundle: true,
}
// original code
const myFunc = ()=> {
 DROP: {console.log("drop")}
 console.log("keep")
}
export default myFunc
// esbuild output
export {
  entry_default as default
};

setting bundle to false

// esbuild output
const myFunc = () => {
  console.log("keep");
};
var entry_default = myFunc;
export {
  entry_default as default
};

online reproduction

@Inqnuam
Copy link
Author

Inqnuam commented Aug 13, 2023

No issue with named export

// original code
const myFunc = ()=> {
DROP: {console.log("drop")}
console.log("keep")
}

export {myFunc}
// esbuild output with both bundle true and false
const myFunc = () => {
  console.log("keep");
};
export {
  myFunc
};

@evanw
Copy link
Owner

evanw commented Aug 14, 2023

That sure is strange. Thanks for the report. Looks like I forgot a popScope() when dropping labels.

@evanw evanw closed this as completed in 4d9b764 Aug 14, 2023
evanw added a commit that referenced this issue Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants