This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change 1
1
import { Options , renderSync } from 'https://esm.sh/[email protected] '
2
2
3
- const defaultPlugin = {
3
+ const pluginFactory = ( opts : Options = { } ) => ( {
4
4
name : 'sass-loader' ,
5
5
test : / .( s a s s | s c s s ) $ / ,
6
6
acceptHMR : true ,
7
- transform ( content : Uint8Array , path : string ) {
8
- const ret = renderSync ( {
9
- file : path ,
10
- data : ( new TextDecoder ) . decode ( content ) ,
11
- sourceMap : true ,
12
- indentedSyntax : path . endsWith ( '.sass' )
13
- } )
14
- return {
15
- code : ( new TextDecoder ) . decode ( ret . css ) ,
16
- map : ret . map ? ( new TextDecoder ) . decode ( ret . map ) : undefined ,
17
- loader : 'css'
18
- }
19
- }
20
- }
21
-
22
- const pluginFactory = ( opts : Options ) => ( {
23
- ...defaultPlugin ,
24
7
transform ( content : Uint8Array , path : string ) {
25
8
const ret = renderSync ( {
26
9
indentedSyntax : path . endsWith ( '.sass' ) ,
@@ -37,6 +20,8 @@ const pluginFactory = (opts: Options) => ({
37
20
}
38
21
} )
39
22
23
+ const defaultPlugin = pluginFactory ( )
24
+
40
25
pluginFactory . displayName = defaultPlugin . name
41
26
pluginFactory . test = defaultPlugin . test
42
27
pluginFactory . acceptHMR = defaultPlugin . acceptHMR
You can’t perform that action at this time.
0 commit comments