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

feat: enable new tree shaking in production #1839

Merged
merged 1 commit into from
Mar 15, 2024
Merged

Conversation

chenjiahan
Copy link
Member

Summary

Rsbuild v0.5.0 will enable the Rspack's new tree shaking in production build. This will significantly optimize the tree shaking algorithm, making the bundle size smaller in the production build.

If you encounter any issues with the new tree shaking in your project, you can report it to the Rspack repository through an issue. You can also manually switch to old tree shaking:

// rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';

export default defineConfig({
  tools: {
    rspack: {
      experiments: {
        rspackFuture: {
          newTreeshaking: false,
        },
      },
    },
  },
});

Note that Rsbuild only enable new tree shaking in production build, because Rspack still has some problems when using it in dev mode. Such as web-infra-dev/rspack#5887

Related Links

web-infra-dev/rspack#5887

Checklist

  • Tests updated.
  • Documentation updated.

@chenjiahan chenjiahan merged commit 444a0d1 into main Mar 15, 2024
7 checks passed
@chenjiahan chenjiahan deleted the new_tree_shaking_0315 branch March 15, 2024 03:23
@chenjiahan chenjiahan mentioned this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant