File tree Expand file tree Collapse file tree 4 files changed +18
-12
lines changed
tests/integration/style/less Expand file tree Collapse file tree 4 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 11/**
22 * The following code is modified based on
33 * https://github.com/web-infra-dev/rspack/blob/0a89e433a9f8596a7c6c4326542f168b5982d2da/packages/rspack/src/builtin-plugin/css-extract/loader.ts
4+ * 1. remove hmr/webpack runtime
5+ * 2. add `this.emitFile` to emit css files
6+ * 3. add `import './[name].css';`
47 */
58import path , { extname } from 'node:path' ;
69import type { LoaderDefinition } from '@rspack/core' ;
Original file line number Diff line number Diff line change 1+ import { createRequire } from 'node:module' ;
12import path from 'node:path' ;
2- import type { RsbuildConfig , RsbuildPlugin } from '@rsbuild/core' ;
3+ import type {
4+ CSSLoaderOptions ,
5+ RsbuildConfig ,
6+ RsbuildPlugin ,
7+ } from '@rsbuild/core' ;
38import { CSS_EXTENSIONS_PATTERN } from '../constant' ;
49import { RemoveCssExtractAssetPlugin } from './RemoveCssExtractAssetPlugin' ;
10+ const require = createRequire ( import . meta. url ) ;
511
612export const RSLIB_TEMP_CSS_DIR = '__rslib_css__' ;
713
8- // https://rsbuild.dev/zh/config/output/css-modules#cssmodulesauto
9- export type CssLoaderOptionsAuto =
10- | boolean
11- | RegExp
12- | ( (
13- resourcePath : string ,
14- resourceQuery : string ,
15- resourceFragment : string ,
16- ) => boolean ) ;
14+ // https://rsbuild.dev/config/output/css-modules#cssmodulesauto
15+ export type CssLoaderOptionsAuto = CSSLoaderOptions [ 'modules' ] extends infer T
16+ ? T extends { auto ?: any }
17+ ? T [ 'auto' ]
18+ : never
19+ : never ;
1720
1821export function isCssFile ( filepath : string ) : boolean {
1922 return CSS_EXTENSIONS_PATTERN . test ( filepath ) ;
Original file line number Diff line number Diff line change 11{
2- "name" : " less-bundle-test" ,
2+ "name" : " less-bundle-false- test" ,
33 "version" : " 1.0.0" ,
44 "private" : true ,
55 "type" : " module"
Original file line number Diff line number Diff line change 11{
2- "name" : " less-bundle-test" ,
2+ "name" : " less-bundle-import- test" ,
33 "version" : " 1.0.0" ,
44 "private" : true ,
55 "type" : " module"
You can’t perform that action at this time.
0 commit comments