@@ -36,9 +36,10 @@ const buildTs = (watch: boolean, outdir: string, babelOptions: any, wholeProject
3636} ;
3737
3838const buildSass = ( watch : boolean , outdir : string , wholeProject : boolean ) => {
39- const targetPath = wholeProject
40- ? path . join ( pri . projectRootPath , '{src,packages}/**/*.scss' )
41- : path . join ( pri . sourceRoot , srcPath . dir , '**/*.scss' ) ;
39+ const targetPath =
40+ wholeProject || ( pri . selectedSourceType === 'root' && pri . sourceConfig . cssExtract )
41+ ? path . join ( pri . projectRootPath , '{src,packages}/**/*.scss' )
42+ : path . join ( pri . sourceRoot , srcPath . dir , '**/*.scss' ) ;
4243
4344 return new Promise ( ( resolve , reject ) => {
4445 getGulpByWatch ( watch , targetPath )
@@ -52,9 +53,10 @@ const buildSass = (watch: boolean, outdir: string, wholeProject: boolean) => {
5253} ;
5354
5455const mvResources = ( watch : boolean , outdir : string , wholeProject : boolean ) => {
55- const targetPath = wholeProject
56- ? path . join ( pri . projectRootPath , '{src,packages}/**/*.{js,png,jpg,jpeg,gif,woff,woff2,eot,ttf,svg}' )
57- : path . join ( pri . sourceRoot , srcPath . dir , '**/*.{js,png,jpg,jpeg,gif,woff,woff2,eot,ttf,svg}' ) ;
56+ const targetPath =
57+ wholeProject || ( pri . selectedSourceType === 'root' && pri . sourceConfig . cssExtract )
58+ ? path . join ( pri . projectRootPath , '{src,packages}/**/*.{js,png,jpg,jpeg,gif,woff,woff2,eot,ttf,svg}' )
59+ : path . join ( pri . sourceRoot , srcPath . dir , '**/*.{js,png,jpg,jpeg,gif,woff,woff2,eot,ttf,svg}' ) ;
5860
5961 return new Promise ( ( resolve , reject ) => {
6062 getGulpByWatch ( watch , targetPath )
@@ -96,12 +98,14 @@ function importRename(packageAbsoluteToRelative = false) {
9698}
9799
98100export const tsPlusBabel = async ( watch = false , wholeProject = false ) => {
99- const mainDistPath = path . join ( globalState . projectRootPath , pri . sourceConfig . distDir , 'main' ) ;
100- const moduleDistPath = path . join ( globalState . projectRootPath , pri . sourceConfig . distDir , 'module' ) ;
101+ const rootDistPath = path . join ( globalState . projectRootPath , pri . sourceConfig . distDir ) ;
102+ const mainDistPath = path . join ( rootDistPath , 'main' ) ;
103+ const moduleDistPath = path . join ( rootDistPath , 'module' ) ;
101104
102105 return Promise . all ( [
103106 buildSass ( watch , mainDistPath , wholeProject ) ,
104- mvResources ( watch , mainDistPath , wholeProject ) ,
107+ buildSass ( watch , moduleDistPath , wholeProject ) ,
108+
105109 buildTs (
106110 watch ,
107111 mainDistPath ,
@@ -110,8 +114,6 @@ export const tsPlusBabel = async (watch = false, wholeProject = false) => {
110114 } ) ,
111115 wholeProject ,
112116 ) ,
113- buildSass ( watch , moduleDistPath , wholeProject ) ,
114- mvResources ( watch , moduleDistPath , wholeProject ) ,
115117 buildTs (
116118 watch ,
117119 moduleDistPath ,
@@ -121,5 +123,8 @@ export const tsPlusBabel = async (watch = false, wholeProject = false) => {
121123 } ) ,
122124 wholeProject ,
123125 ) ,
126+
127+ mvResources ( watch , mainDistPath , wholeProject ) ,
128+ mvResources ( watch , moduleDistPath , wholeProject ) ,
124129 ] ) ;
125130} ;
0 commit comments