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

Unused code is left when minifying #3899

Open
just-boris opened this issue Aug 28, 2024 · 0 comments
Open

Unused code is left when minifying #3899

just-boris opened this issue Aug 28, 2024 · 0 comments

Comments

@just-boris
Copy link

just-boris commented Aug 28, 2024

When a constant value imported from a different module, it is not inlined properly. Reproducible in the online playground.

import { isDevelopment } from "./is-development";

export function devWarning() {
 if(isDevelopment) {
   console.log('test')
 }
}


export function run() {
  devWarning('dev only');
}

is-development.js contents

export const isDevelopment = false; 
// does not work either 
// export const isDevelopment = process.env.NODE_ENV !== "production";

The output still contains an unused function: function o(){!1}. Expected to eliminate all this code, as it happens in a single file setup

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

1 participant