Skip to content

Conversation

@JSerFeng
Copy link
Contributor

@JSerFeng JSerFeng commented Jan 9, 2026

Summary

Introduce rspackExperiments.transformImport, it has the same capability as rspackExperiments.import, but with more easy-to-use API.

See output here, only the first item has specifier, the rest items are just render as normal import '{{source}}'

import { specifier } from "{{output[0]}}"
import "{{output[1]}}"

Example:

export default {
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'builtin:swc-loader',
        options: {
          rspackExperiments: {
            transformImport: [
              {
                source: 'lib',
                namedImport: false,
                output: [
                  'lib/{{ kebabCase filename }}',
                  'lib/{{ kebabCase filename }}/style.css',
                ],
              },
            ],
          },
        },
      },
    ],
  },
};
import { MyButton, MyInput } from 'lib';

// 👇

import MyButton from 'lib/my-button';
import 'lib/my-button/style.css';
import MyInput from 'lib/my-input';
import 'lib/my-input/style.css';

Related links

Checklist

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

@netlify
Copy link

netlify bot commented Jan 9, 2026

Deploy Preview for rspack-v2 ready!

Name Link
🔨 Latest commit 644d9cc
🔍 Latest deploy log https://app.netlify.com/projects/rspack-v2/deploys/69609dd230808c0008d69381
😎 Deploy Preview https://deploy-preview-12689--rspack-v2.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.

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Jan 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

📦 Binary Size-limit

Comparing 644d9cc to feat: rspack_cacheable context expose project root (#12685) by jinrui

🎉 Size decreased by 318.00KB from 47.87MB to 47.56MB (⬇️0.65%)

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 3 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB -8.0 B (-0.0%)
react-1k 825.4 KB 0
react-5k 2.7 MB +1.0 B (0.0%)
rome 986.0 KB +1.7 KB (0.2%)
ui-components 2.1 MB 0
📋 Detailed Reports (Click to expand)

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: 0d1d58f8b8 | PR: #12688

Metric Current Baseline Change
📊 Total Size 5.7 MB 5.7 MB -8.0 B (-0.0%)
📄 JavaScript 5.7 MB 5.7 MB -8.0 B (-0.0%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-10k Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: 0d1d58f8b8 | PR: #12688

Metric Current Baseline Change
📊 Total Size 2.7 MB 2.7 MB +1.0 B (0.0%)
📄 JavaScript 2.7 MB 2.7 MB +1.0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-5k Bundle Diff

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

📌 Baseline Commit: 0d1d58f8b8 | PR: #12688

Metric Current Baseline Change
📊 Total Size 986.0 KB 984.3 KB +1.7 KB (0.2%)
📄 JavaScript 986.0 KB 984.3 KB +1.7 KB (0.2%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: rome Bundle Diff

Generated by Rsdoctor GitHub Action

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 9, 2026

Merging this PR will not alter performance

Summary

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing refacotr/swc-plugin-import (644d9cc) with v2 (45d4892)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@JSerFeng
Copy link
Contributor Author

@chenjiahan @ityuany what do you think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant