fix(es/minifier): Don't drop unused properties of top-level vars (#7638)

**Related issue:**

 - Closes #7635.
This commit is contained in:
Donny/강동윤 2023-07-07 13:07:13 +09:00 committed by GitHub
parent e80c695c89
commit 19ba714ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -835,6 +835,10 @@ impl Optimizer<'_> {
return None;
}
if self.ctx.top_level && !self.options.top_level() {
return None;
}
let name = v.name.as_ident()?;
let obj = v.init.as_mut()?.as_mut_object()?;

View File

@ -1,5 +1,6 @@
import { s as style, m } from "../index.f66dda46.js";
const process = {
browser: !0,
env: {
FOO: "bar",
OVERRIDE: "11",

View File

@ -1,5 +1,7 @@
import { s as style, y, m } from "../index.f66dda46.js";
const styles = {};
const styles = {
about: "about_migxty"
};
function About({ query, title }) {
return y(()=>(console.log("Mounted About: ", title), ()=>{
console.log("Unmounting About: ", title);