Skip to content

Commit e5082ed

Browse files
authored
feat: support stylus in bundleless mode (#707)
1 parent d213f43 commit e5082ed

File tree

12 files changed

+314
-16
lines changed

12 files changed

+314
-16
lines changed

packages/core/src/constant.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ const JS_EXTENSIONS: string[] = [
3333
'ctsx',
3434
] as const;
3535

36-
const CSS_EXTENSIONS: string[] = ['css', 'sass', 'scss', 'less'] as const;
36+
const CSS_EXTENSIONS: string[] = [
37+
'css',
38+
'sass',
39+
'scss',
40+
'less',
41+
'styl',
42+
'stylus',
43+
] as const;
3744

3845
export const JS_EXTENSIONS_PATTERN: RegExp = new RegExp(
3946
`\\.(${JS_EXTENSIONS.join('|')})$`,

pnpm-lock.yaml

Lines changed: 91 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ export default defineConfig({
1818
],
1919
output: {
2020
target: 'web',
21-
assetPrefix: 'auto', // TODO: move this line to packages/core/src/asset/assetConfig.ts
2221
},
2322
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body
2+
color red
3+
font 14px Arial, sans-serif
4+
background: url('./assets/logo.svg');
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.title-class
2+
font-size: 14px;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import './a.styl';
2+
import style from './b.module.styl';
3+
4+
console.log(style);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "style-stylus-bundle-false-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"devDependencies": {
7+
"@rsbuild/plugin-stylus": "^1.0.7"
8+
}
9+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { pluginStylus } from '@rsbuild/plugin-stylus';
2+
import { defineConfig } from '@rslib/core';
3+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
4+
5+
export default defineConfig({
6+
lib: [
7+
generateBundleEsmConfig({
8+
bundle: false,
9+
}),
10+
generateBundleCjsConfig({
11+
bundle: false,
12+
}),
13+
],
14+
source: {
15+
entry: {
16+
index: ['../__fixtures__/src/**'],
17+
},
18+
},
19+
plugins: [pluginStylus()],
20+
output: {
21+
target: 'web',
22+
},
23+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "style-stylus-bundle-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"devDependencies": {
7+
"@rsbuild/plugin-stylus": "^1.0.7"
8+
}
9+
}

0 commit comments

Comments
 (0)