Skip to content

Commit 1e68158

Browse files
authored
feat: support css in bundless mode (#206)
1 parent aca3af8 commit 1e68158

File tree

137 files changed

+2464
-65
lines changed

Some content is hidden

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

137 files changed

+2464
-65
lines changed

.prettierignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ doc_build
77
**/*.js
88
**/*.ts
99
**/*.jsx
10-
**/*.tsx
10+
**/*.tsx
11+
12+
# ignore pnpm-lock
13+
pnpm-lock.yaml

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,14 @@
3838
"[typescriptreact]": {
3939
"editor.defaultFormatter": "biomejs.biome"
4040
},
41+
"[css]": {
42+
"editor.defaultFormatter": "esbenp.prettier-vscode"
43+
},
44+
"[sass]": {
45+
"editor.defaultFormatter": "esbenp.prettier-vscode"
46+
},
47+
"[less]": {
48+
"editor.defaultFormatter": "esbenp.prettier-vscode"
49+
},
4150
"typescript.tsdk": "node_modules/typescript/lib"
4251
}

biome.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
"enabled": false
3535
}
3636
},
37+
"css": {
38+
"formatter": {
39+
"enabled": false
40+
}
41+
},
3742
"linter": {
3843
"enabled": true,
3944
"ignore": ["./tests/integration/**/*/src/*"],
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@examples/react-component-bundle-false",
3+
"private": true,
4+
"main": "./dist/cjs/index.js",
5+
"module": "./dist/esm/index.mjs",
6+
"types": "./dist/cjs/index.d.ts",
7+
"scripts": {
8+
"build": "rslib build"
9+
},
10+
"devDependencies": {
11+
"@rsbuild/plugin-react": "^1.0.2",
12+
"@rsbuild/plugin-sass": "^1.0.1",
13+
"@rslib/core": "workspace:*",
14+
"@types/react": "^18.3.5",
15+
"react": "^18.3.1"
16+
},
17+
"peerDependencies": {
18+
"react": "*"
19+
}
20+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { pluginReact } from '@rsbuild/plugin-react';
2+
import { pluginSass } from '@rsbuild/plugin-sass';
3+
import { type LibConfig, defineConfig } from '@rslib/core';
4+
5+
const shared: LibConfig = {
6+
bundle: false,
7+
dts: {
8+
bundle: false,
9+
},
10+
};
11+
12+
export default defineConfig({
13+
source: {
14+
entry: {
15+
index: ['./src/**', '!./src/env.d.ts'],
16+
},
17+
},
18+
lib: [
19+
{
20+
...shared,
21+
format: 'esm',
22+
output: {
23+
distPath: {
24+
root: './dist/esm',
25+
},
26+
},
27+
},
28+
{
29+
...shared,
30+
format: 'cjs',
31+
output: {
32+
distPath: {
33+
root: './dist/cjs',
34+
},
35+
},
36+
},
37+
],
38+
plugins: [pluginReact(), pluginSass()],
39+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.button {
2+
background: yellow;
3+
}

examples/react-component/src/CounterButton.tsx renamed to examples/react-component-bundle-false/src/components/CounterButton/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import styles from './index.module.scss';
12
interface CounterButtonProps {
23
onClick: () => void;
34
label: string;
@@ -7,7 +8,7 @@ export const CounterButton: React.FC<CounterButtonProps> = ({
78
onClick,
89
label,
910
}) => (
10-
<button type="button" onClick={onClick}>
11+
<button type="button" className={styles.button} onClick={onClick}>
1112
{label}
1213
</button>
1314
);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.module.scss' {
2+
const classes: { [key: string]: string };
3+
export default classes;
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.counter-text {
2+
font-size: 50px;
3+
}

0 commit comments

Comments
 (0)