File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export default defineConfig({
5858 // return `${spilittedFileName[0]}Names`
5959 // },
6060 // },
61+ useNamedExport : false ,
6162 } ) ,
6263 ] ,
6364} )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export type PluginOptions = {
1616 sourceDir ?: string
1717 excludePath ?: string | RegExp | Array < string | RegExp >
1818 prettierFilePath ?: string
19+ useNamedExport ?: boolean
1920}
2021
2122export type CSS = { localStyle : string ; globalStyle ?: string }
Original file line number Diff line number Diff line change @@ -38,9 +38,15 @@ export const writeToFile = async (
3838 options . global . outputFilePath
3939 )
4040 outputFileString = `import globalClassNames from '${ relativePath } ${ exportTypeFileName } '\n`
41- outputFileString = `${ outputFileString } \n${ namedExports } \n\ndeclare const classNames: typeof globalClassNames & {${ exportTypes } \n};\n${ exportStyle } `
41+ outputFileString = `declare const classNames: typeof globalClassNames & {${ exportTypes } \n};\n${ exportStyle } `
42+ if ( options ?. useNamedExport ) {
43+ outputFileString = `${ outputFileString } \n${ namedExports } \n\n`
44+ }
4245 } else {
43- outputFileString = `${ namedExports } \n\ndeclare const classNames: {${ exportTypes } \n};\n${ exportStyle } `
46+ outputFileString = `declare const classNames: {${ exportTypes } \n};\n${ exportStyle } `
47+ if ( options ?. useNamedExport ) {
48+ outputFileString = `${ outputFileString } \n\n${ namedExports } `
49+ }
4450 }
4551
4652 const prettierdOutputFileString = await format (
You can’t perform that action at this time.
0 commit comments