Skip to content

Commit c3fed95

Browse files
committed
chore: rebase
1 parent f54b6ff commit c3fed95

File tree

24 files changed

+101
-24
lines changed

24 files changed

+101
-24
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
h2 {
1+
.counter-text {
22
font-size: 50px;
33
}

examples/react-component-bundle-false/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CounterButton } from './components/CounterButton';
1+
import { CounterButton } from './components/CounterButton/index';
22
import { useCounter } from './useCounter';
33
import './index.scss';
44

@@ -7,7 +7,7 @@ export const Counter: React.FC = () => {
77

88
return (
99
<div>
10-
<h2>Counter: {count}</h2>
10+
<h2 className="counter-text">Counter: {count}</h2>
1111
<CounterButton onClick={decrement} label="-" />
1212
<CounterButton onClick={increment} label="+" />
1313
</div>

examples/react-component-bundle/src/env.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
declare module '*.module.css' {
2-
const classes: { [key: string]: string };
3-
export default classes;
4-
}
5-
61
declare module '*.module.scss' {
72
const classes: { [key: string]: string };
83
export default classes;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
h2 {
1+
.counter-text {
22
font-size: 50px;
33
}

examples/react-component-bundle/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CounterButton } from './components/CounterButton';
1+
import { CounterButton } from './components/CounterButton/index';
22
import { useCounter } from './useCounter';
33
import './index.scss';
44

@@ -7,7 +7,7 @@ export const Counter: React.FC = () => {
77

88
return (
99
<div>
10-
<h2>Counter: {count}</h2>
10+
<h2 className="counter-text">Counter: {count}</h2>
1111
<CounterButton onClick={decrement} label="-" />
1212
<CounterButton onClick={increment} label="+" />
1313
</div>

packages/core/src/config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,14 +702,13 @@ const composeEntryConfig = async (
702702
};
703703

704704
const composeBundleConfig = (
705-
config: RsbuildConfig,
706705
jsExtension: string,
707706
redirect: Redirect,
707+
cssModulesAuto: CssLoaderOptionsAuto,
708708
bundle = true,
709709
): RsbuildConfig => {
710710
if (bundle) return {};
711711

712-
const cssModulesAuto = config.output?.cssModules?.auto ?? true;
713712
const isStyleRedirect = redirect.style ?? true;
714713

715714
return {
@@ -918,9 +917,9 @@ async function composeLibRsbuildConfig(config: LibConfig, configPath: string) {
918917
dtsExtension,
919918
} = composeAutoExtensionConfig(config, autoExtension, pkgJson);
920919
const bundleConfig = composeBundleConfig(
921-
config,
922920
jsExtension,
923921
redirect,
922+
cssModulesAuto,
924923
config.bundle,
925924
);
926925
const targetConfig = composeTargetConfig(config.output?.target);

tests/benchmark/index.bench.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ describe('run rslib in examples', () => {
1111
{ time: 5 },
1212
);
1313
bench(
14-
'examples/react-component',
14+
'examples/react-component-bundle',
1515
async () => {
16-
const cwd = getCwdByExample('react-component');
16+
const cwd = getCwdByExample('react-component-bundle');
1717
await rslibBuild(cwd);
1818
},
1919
{ time: 5 },
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.content-wrapper {
2+
background-color: #fff;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import styles from './index.module.scss';
2+
3+
export default styles;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@rsbuild/core/types" />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import button from './button/index';
2+
// @ts-ignore
3+
import stylesAuto from './reset.scss';
4+
5+
export { stylesAuto, button };
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.outer {
2+
color: red;
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "@rslib/tsconfig/base",
3+
"compilerOptions": {
4+
"baseUrl": "./"
5+
},
6+
"include": ["src"]
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "css-bundle-false-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { pluginSass } from '@rsbuild/plugin-sass';
2+
import { defineConfig } from '@rslib/core';
3+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
4+
5+
export default defineConfig({
6+
lib: [
7+
generateBundleEsmConfig({ bundle: false }),
8+
generateBundleCjsConfig({ bundle: false }),
9+
],
10+
source: {
11+
entry: {
12+
index: ['../__fixtures__/basic/src/**', '!../__fixtures__/**/*.d.ts'],
13+
},
14+
},
15+
plugins: [
16+
pluginSass({
17+
sassLoaderOptions: {
18+
additionalData: '$base-color: #c6538c;',
19+
},
20+
}),
21+
],
22+
output: {
23+
cssModules: {
24+
auto: /\.scss/,
25+
},
26+
},
27+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "css-bundle-false-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { pluginSass } from '@rsbuild/plugin-sass';
2+
import { defineConfig } from '@rslib/core';
3+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
4+
5+
export default defineConfig({
6+
lib: [
7+
generateBundleEsmConfig({ bundle: false }),
8+
generateBundleCjsConfig({ bundle: false }),
9+
],
10+
source: {
11+
entry: {
12+
index: ['../__fixtures__/basic/src/**'],
13+
},
14+
},
15+
plugins: [
16+
pluginSass({
17+
sassLoaderOptions: {
18+
additionalData: '$base-color: #c6538c;',
19+
},
20+
}),
21+
],
22+
});

tests/integration/style/css/bundle-false/rslib.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
21
import { defineConfig } from '@rslib/core';
2+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
33

44
export default defineConfig({
55
lib: [

tests/integration/style/css/bundle/rslib.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
21
import { defineConfig } from '@rslib/core';
2+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
33

44
export default defineConfig({
55
lib: [generateBundleEsmConfig(), generateBundleCjsConfig()],

tests/integration/style/css/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join } from 'node:path';
2-
import { buildAndGetResults } from '@e2e/helper';
2+
import { buildAndGetResults } from 'test-helper';
33
import { expect, test } from 'vitest';
44

55
test('should run build successfully when set bundle: true', async () => {

tests/integration/style/sass/bundle-false/rslib.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
21
import { pluginSass } from '@rsbuild/plugin-sass';
32
import { defineConfig } from '@rslib/core';
3+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
44

55
export default defineConfig({
66
lib: [
77
generateBundleEsmConfig({ bundle: false }),
88
generateBundleCjsConfig({ bundle: false }),
99
],
10-
tools: {},
1110
source: {
1211
entry: {
1312
index: [

tests/integration/style/sass/bundle/rslib.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
21
import { pluginSass } from '@rsbuild/plugin-sass';
32
import { defineConfig } from '@rslib/core';
3+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
44

55
export default defineConfig({
66
lib: [generateBundleEsmConfig(), generateBundleCjsConfig()],

tests/integration/style/sass/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join } from 'node:path';
2-
import { buildAndGetResults } from '@e2e/helper';
2+
import { buildAndGetResults } from 'test-helper';
33
import { expect, test } from 'vitest';
44

55
test('should extract css with pluginSass when set bundle: true', async () => {

tests/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"composite": true
66
},
77
"include": [
8-
"e2e/cases/**/*.ts",
8+
"e2e/**/*.ts",
9+
"integration/**/*.ts",
910
"benchmark/**/*.ts",
1011
"playwright.config.ts",
1112
"scripts"

0 commit comments

Comments
 (0)