npm @rspack/core 1.5.7
v1.5.7

7 hours ago

Highlights 💡

Improved Tree Shaking for Dynamic Import .then()

This release enhances tree shaking capabilities specifically for the .then() callbacks of dynamic imports. Rspack can now statically analyze and eliminate unused exports when destructuring is performed on the resolved module within promise chains:

// Tree shaking now works for destructuring in .then() callbacks
import('./utils').then(module => {
  const { usedFunction } = module; // Only usedFunction will be included
  usedFunction();
  // unusedFunction will be tree-shaken out
});

JSX Preserve Support

Rspack now supports parsing and preserving JSX syntax. This allows JSX syntax to be parsed without transformation, making it compatible with external JSX transformers.

// rspack.config.js
export default {
  module: {
    parser: {
      javascript: {
        jsx: true // Enable JSX parsing
      }
    },
    rules: [
      {
        test: /\.jsx?$/,
        use: {
          loader: 'swc-loader',
          options: {
            jsc: {
              parser: { jsx: true },
              transform: {
                // Preserve JSX syntax
                react: { runtime: 'preserve' }
              }
            }
          }
        }
      }
    ]
  }
};

What's Changed

New Features 🎉

  • feat: static analyze destructuring assignment dynamic import variable for tree shaking by @ahabhgk in #11731
  • feat: parser support jsx by @fi3ework in #11664

Bug Fixes 🐞

Document Updates 📖

Other Changes

Full Changelog: v1.5.6...v1.5.7

Don't miss a new core release

NewReleases is sending notifications on new releases.