File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
lib/esbuild-plugin-react18-css/src Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -121,17 +121,18 @@ function handleModules(build: PluginBuild, { generateScopedName }: CSSPluginOpti
121121 } ) ) ;
122122}
123123
124+ function resolveScopedName ( options : CSSPluginOptions ) {
125+ const globalPrefix = options . globalPrefix ?? "" ;
126+ options . generateScopedName = ( name , filename ) =>
127+ ( globalPrefix ? `${ globalPrefix } __` : "" ) + `${ path . basename ( filename ) . split ( "." ) [ 0 ] } __${ name } ` ;
128+ }
129+
124130const cssPlugin : ( options ?: CSSPluginOptions ) => Plugin = ( options = { } ) => ( {
125131 name : "esbuild-plugin-react18-css-" + uuid ( ) ,
126132 setup ( build ) : void {
127133 const write = build . initialOptions . write ;
128134 build . initialOptions . write = false ;
129- if ( ! options . generateScopedName ) {
130- const globalPrefix = options . globalPrefix ?? "" ;
131- options . generateScopedName = ( name , filename ) =>
132- ( globalPrefix ? `${ globalPrefix } __` : "" ) +
133- `${ path . basename ( filename ) . split ( "." ) [ 0 ] } __${ name } ` ;
134- }
135+ if ( ! options . generateScopedName ) resolveScopedName ( options ) ;
135136 handleModules ( build , options ) ;
136137 handleScss ( build ) ;
137138 applyAutoPrefixer ( build , options , write ) ;
You can’t perform that action at this time.
0 commit comments