Skip to content

Commit fe8ce3e

Browse files
feat: introduce experiments.advancedEsm with Rspack's EsmLibraryPlugin (#1273)
Co-authored-by: Timeless0911 <1604889533@qq.com>
1 parent 006fcd5 commit fe8ce3e

File tree

43 files changed

+1512
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1512
-558
lines changed

.github/workflows/preview.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
push:
66
branches: [main]
77
workflow_dispatch:
8+
inputs:
9+
branch:
10+
description: 'Branch to release'
11+
required: true
12+
default: 'main'
813

914
permissions:
1015
contents: read
@@ -19,6 +24,7 @@ jobs:
1924
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2025
with:
2126
fetch-depth: 1
27+
ref: ${{ github.event.inputs.branch }}
2228

2329
- name: Install pnpm
2430
run: |

.github/workflows/reusable-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ jobs:
9292
if: ${{ steps.changes.outputs.changed == 'true' && inputs.task == 'integration' }}
9393
run: pnpm run test:integration
9494

95+
- name: Integration Test with Advanced ESM (Rstest)
96+
if: ${{ steps.changes.outputs.changed == 'true' && inputs.task == 'integration-advanced-esm' }}
97+
run: pnpm run test:integration:advanced-esm
98+
9599
- name: E2E Test (Playwright)
96100
if: ${{ steps.changes.outputs.changed == 'true' && inputs.task == 'e2e' }}
97101
run: pnpm run test:e2e

.github/workflows/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ jobs:
3939
node-version: ${{ matrix.node-version }}
4040
task: integration
4141

42+
integration-advanced-esm:
43+
strategy:
44+
matrix:
45+
runner: [ubuntu-latest, windows-latest]
46+
node-version: [22]
47+
uses: ./.github/workflows/reusable-test.yml
48+
with:
49+
runner: ${{ matrix.runner }}
50+
node-version: ${{ matrix.node-version }}
51+
task: integration-advanced-esm
52+
4253
e2e:
4354
strategy:
4455
matrix:

examples/express-plugin/rslib.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export default defineConfig({
88
output: {
99
distPath: './dist/esm',
1010
},
11+
experiments: {
12+
advancedEsm: true,
13+
},
1114
},
1215
{
1316
format: 'cjs',

examples/module-federation/mf-react-component/rslib.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export default defineConfig({
1010
output: {
1111
distPath: './dist/esm',
1212
},
13+
experiments: {
14+
advancedEsm: true,
15+
},
1316
},
1417
{
1518
format: 'cjs',

examples/react-component-bundle/rslib.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export default defineConfig({
1010
output: {
1111
distPath: './dist/esm',
1212
},
13+
experiments: {
14+
advancedEsm: true,
15+
},
1316
},
1417
{
1518
format: 'cjs',

examples/solid-component-bundle/rslib.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export default defineConfig({
88
{
99
format: 'esm',
1010
dts: true,
11+
experiments: {
12+
advancedEsm: true,
13+
},
1114
},
1215
],
1316
output: {

examples/vue-component-bundle/rslib.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
33

44
export default defineConfig({
55
plugins: [pluginUnpluginVue()],
6-
lib: [{ format: 'esm' }],
6+
lib: [
7+
{
8+
format: 'esm',
9+
experiments: {
10+
advancedEsm: true,
11+
},
12+
},
13+
],
714
output: {
815
target: 'web',
916
},

examples/vue-component-bundleless/rslib.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
33

44
export default defineConfig({
55
plugins: [pluginUnpluginVue()],
6-
lib: [{ bundle: false, format: 'esm' }],
6+
lib: [
7+
{
8+
format: 'esm',
9+
bundle: false,
10+
},
11+
],
712
output: {
813
target: 'web',
914
},

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
"prebundle": "nx run-many -t prebundle",
1616
"prepare": "pnpm run build && simple-git-hooks",
1717
"sort-package-json": "npx sort-package-json \"packages/*/package.json\"",
18-
"test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:e2e",
18+
"test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:integration:advanced-esm && pnpm run test:e2e",
1919
"test:benchmark": "cd ./tests && pnpm run test:benchmark",
2020
"test:e2e": "pnpm run build:examples && cd tests && pnpm run test:e2e",
21-
"test:ecosystem-ci": "pnpm run test:unit && cross-env ECO_CI=1 pnpm run test:integration && pnpm run test:e2e",
21+
"test:ecosystem-ci": "pnpm run test:unit && cross-env ECO_CI=1 pnpm run test:integration && cross-env ECO_CI=1 pnpm run test:integration:advanced-esm && pnpm run test:e2e",
2222
"test:integration": "rstest run --project integration",
23+
"test:integration:advanced-esm": "cross-env ADVANCED_ESM=1 rstest run --project integration",
2324
"test:unit": "rstest run --project unit*",
24-
"testu": "pnpm run test:unit -u && pnpm run test:integration -u",
25+
"testu": "pnpm run test:unit -u && pnpm run test:integration -u && pnpm test:integration:advanced-esm -u",
2526
"type-check": "pnpm -r run type-check",
2627
"update:rsbuild": "npx taze minor --include /rsbuild/ -w -r -l",
2728
"watch": "pnpm build --watch"

0 commit comments

Comments
 (0)