mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 02:06:08 +03:00
fix(es/minifier): Don't remove exports (#7856)
This commit is contained in:
parent
5ae2e810d8
commit
ae8cd9430d
@ -318,6 +318,10 @@ impl From<&Function> for FnMetadata {
|
||||
|
||||
impl Optimizer<'_> {
|
||||
fn may_remove_ident(&self, id: &Ident) -> bool {
|
||||
if self.ctx.is_exported {
|
||||
return false;
|
||||
}
|
||||
|
||||
if id.span.ctxt != self.marks.top_level_ctxt {
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
const a = () => "";
|
||||
const b = {};
|
||||
export const c = a;
|
||||
b.c = c;
|
@ -0,0 +1 @@
|
||||
export const c = ()=>"";
|
@ -0,0 +1,5 @@
|
||||
export const a = 4;
|
||||
export const b = 16;
|
||||
export const c = 5;
|
||||
|
||||
export const d = () => a;
|
@ -0,0 +1,4 @@
|
||||
export const a = 4;
|
||||
export const b = 16;
|
||||
export const c = 5;
|
||||
export const d = ()=>4;
|
Loading…
Reference in New Issue
Block a user