File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,10 @@ module.exports = function (options = {}) {
4747 const data = fs . readFileSync ( filePath , {
4848 encoding : 'utf8' ,
4949 } ) ;
50- fs . writeFileSync ( filePath , `import './${ cssFile } ';\n${ data } ` ) ;
50+
51+ const filePathDepth = file . split ( '/' ) . length - 1 ;
52+ const relativePath = Array ( filePathDepth ) . fill ( '../' ) . join ( '' ) ;
53+ fs . writeFileSync ( filePath , `import './${ relativePath } ${ cssFile } ';\n${ data } ` ) ;
5154 }
5255 } ,
5356 } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " vite-plugin-libcss" ,
33 "description" : " This plugin will inject css into bundled js file using `import` statement." ,
4- "version" : " 1.1.1 " ,
4+ "version" : " 1.1.2 " ,
55 "main" : " index.js" ,
66 "types" : " index.d.ts" ,
77 "author" : " wxsms@foxmail.com" ,
You can’t perform that action at this time.
0 commit comments