Skip to content

Conversation

fi3ework
Copy link
Member

@fi3ework fi3ework commented Sep 24, 2025

Highlights 💡

Preserve JSX

Rslib supports setting the JSX runtime to 'preserve' to leave JSX syntax unchanged without transforming it, which is useful when you expect JSX to be left as is in library development.

// rslib.config.ts
import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rslib/core';

export default defineConfig({
  lib: [
    // ...
  ],
  output: {
    target: 'web',
  },
  plugins: [
    pluginReact({
      swcReactOptions: {
        runtime: 'preserve',
      },
    }),
  ],
});

See JSX transform - React for more details.

Summary

third(final) step after web-infra-dev/rsbuild#6240.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@fi3ework fi3ework changed the title fix: avoid chunk conflication when muliple libs present fix: support JSX preserve Sep 24, 2025
@Timeless0911 Timeless0911 changed the title fix: support JSX preserve feat: support JSX preserve Sep 25, 2025
@GRAMMAC1
Copy link

I see @rsbuild/react-plugin has been released 1.4.1, so when will this PR be merged and a new version be released?

@fi3ework
Copy link
Member Author

fi3ework commented Sep 28, 2025

@GRAMMAC1 1.4.2 expected.

@fi3ework
Copy link
Member Author

@GRAMMAC1 i made a mistake. I just noticed that version 1.4.1 has shipped the commit this PR relies on. i will push this PR for merging now.

Copy link

netlify bot commented Sep 28, 2025

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit f6b3281
🔍 Latest deploy log https://app.netlify.com/projects/rslib/deploys/68d8ebb24a772900086d0f6c
😎 Deploy Preview https://deploy-preview-1244--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@fi3ework fi3ework marked this pull request as ready for review September 28, 2025 06:37
@Copilot Copilot AI review requested due to automatic review settings September 28, 2025 06:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for JSX preserve functionality in rslib, adding the ability to keep native JSX syntax in build outputs for further processing by other tools. This is the final step following a previous related PR.

  • Adds JSX preserve runtime support with bundleless mode requirement
  • Updates documentation to include the new 'preserve' option and usage examples
  • Includes comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 43 out of 44 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
website/docs/*/guide/solution/react.mdx Updated documentation to include JSX preserve option and usage examples
packages/core/src/config.ts Added bundle validation plugin and JSX file extension support for minification
tests/integration/preserve-jsx/ Added comprehensive test suite for JSX preserve functionality
tests/scripts/shared.ts Extended file pattern matching to include .jsx files
Multiple package.json files Updated @rsbuild/plugin-react dependency version to ^1.4.1
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@fi3ework fi3ework enabled auto-merge (squash) September 28, 2025 07:18
@Timeless0911
Copy link
Contributor

@copilot Write a summary which similar to a release note.

@fi3ework
Copy link
Member Author

@copilot Write a summary which similar to a release note.

@fi3ework
Copy link
Member Author

@codex Write a summary which similar to a release note.

Copy link

Summary

Testing

  • ⚠️ Not run (documentation-only changes)

View task →

@fi3ework fi3ework merged commit dcd495a into main Sep 28, 2025
16 checks passed
@fi3ework fi3ework deleted the preserve-jsx branch September 28, 2025 08:46
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.

4 participants