Skip to content

Commit f458645

Browse files
committed
test: add cssModules namedExport example
1 parent 475a3f2 commit f458645

File tree

13 files changed

+111
-1
lines changed

13 files changed

+111
-1
lines changed

pnpm-lock.yaml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ignore typed css module
2+
*.scss.d.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.content-wrapper {
2+
background-color: #fff;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { contentWrapper } from './index.module.scss';
2+
3+
export default contentWrapper;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@rslib/core/types" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import button from './button/index';
2+
3+
export { button };
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "css-modules-named-bundle-false-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { pluginSass } from '@rsbuild/plugin-sass';
2+
import { defineConfig } from '@rslib/core';
3+
import { pluginTypedCSSModules } from "@rsbuild/plugin-typed-css-modules";
4+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
5+
6+
export default defineConfig({
7+
lib: [
8+
generateBundleEsmConfig({ bundle: false }),
9+
generateBundleCjsConfig({ bundle: false }),
10+
],
11+
source: {
12+
entry: {
13+
index: ['../__fixtures__/basic/src/**'],
14+
},
15+
},
16+
output: {
17+
target: 'web',
18+
cssModules: {
19+
namedExport: true,
20+
exportLocalsConvention: 'camelCaseOnly',
21+
},
22+
},
23+
plugins: [
24+
pluginSass({
25+
sassLoaderOptions: {
26+
additionalData: '$base-color: #c6538c;',
27+
},
28+
}),
29+
pluginTypedCSSModules()
30+
],
31+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "css-modules-named-bundle-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { pluginSass } from '@rsbuild/plugin-sass';
2+
import { pluginTypedCSSModules } from "@rsbuild/plugin-typed-css-modules";
3+
import { defineConfig } from '@rslib/core';
4+
import { generateBundleCjsConfig, generateBundleEsmConfig } from 'test-helper';
5+
6+
export default defineConfig({
7+
lib: [generateBundleEsmConfig(), generateBundleCjsConfig()],
8+
source: {
9+
entry: {
10+
index: ['../__fixtures__/basic/src/index.ts'],
11+
},
12+
},
13+
output: {
14+
target: 'web',
15+
cssModules: {
16+
namedExport: true,
17+
exportLocalsConvention: 'camelCaseOnly',
18+
}
19+
},
20+
plugins: [
21+
pluginSass({
22+
sassLoaderOptions: {
23+
additionalData: '$base-color: #c6538c;',
24+
},
25+
}),
26+
pluginTypedCSSModules()
27+
],
28+
});
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/// <reference types="@rsbuild/core/types" />
1+
/// <reference types="@rslib/core/types" />

tests/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@rsbuild/plugin-less": "^1.1.1",
2020
"@rsbuild/plugin-react": "^1.1.1",
2121
"@rsbuild/plugin-sass": "^1.2.2",
22+
"@rsbuild/plugin-typed-css-modules": "^1.0.2",
2223
"@rslib/core": "workspace:*",
2324
"@rslib/tsconfig": "workspace:*",
2425
"@types/fs-extra": "^11.0.4",

0 commit comments

Comments
 (0)