@@ -83,13 +83,14 @@ export type Options = {|
8383 + polyfillModuleNames : Array < string > ,
8484 + postMinifyProcess : PostMinifyProcess ,
8585 + postProcessBundleSourcemap : PostProcessBundleSourcemap ,
86- + projectRoots : $ReadOnlyArray < string > ,
86+ + projectRoot : string ,
8787 + providesModuleNodeModules ?: Array < string > ,
8888 + reporter : Reporter ,
8989 + resolveRequest : ?CustomResolver ,
9090 + sourceExts : Array < string > ,
9191 + transformModulePath : string ,
9292 + watch : boolean ,
93+ + watchFolders : $ReadOnlyArray < string > ,
9394 + workerPath : ?string ,
9495| } ;
9596
@@ -101,17 +102,17 @@ class Bundler {
101102 _baseHash : string ;
102103 _transformer : Transformer ;
103104 _depGraphPromise : Promise < DependencyGraph > ;
104- _projectRoots : $ReadOnlyArray < string > ;
105+ _projectRoot : string ;
105106 _getTransformOptions : void | GetTransformOptions ;
106107
107108 constructor ( opts : Options ) {
108- opts . projectRoots . forEach ( verifyRootExists ) ;
109+ opts . watchFolders . forEach ( verifyRootExists ) ;
109110
110111 const getTransformCacheKey = getTransformCacheKeyFn ( {
111112 asyncRequireModulePath : opts . asyncRequireModulePath ,
112113 cacheVersion : opts . cacheVersion ,
113114 dynamicDepsInPackages : opts . dynamicDepsInPackages ,
114- projectRoots : opts . projectRoots ,
115+ projectRoot : opts . projectRoot ,
115116 transformModulePath : opts . transformModulePath ,
116117 } ) ;
117118
@@ -140,13 +141,14 @@ class Bundler {
140141 mainFields : opts . getResolverMainFields ( ) ,
141142 maxWorkers : opts . maxWorkers ,
142143 platforms : new Set ( opts . platforms ) ,
143- projectRoots : opts . projectRoots ,
144+ projectRoot : opts . projectRoot ,
144145 providesModuleNodeModules :
145146 opts . providesModuleNodeModules || defaults . providesModuleNodeModules ,
146147 reporter : opts . reporter ,
147148 resolveRequest : opts . resolveRequest ,
148149 sourceExts : opts . sourceExts ,
149150 watch : opts . watch ,
151+ watchFolders : opts . watchFolders ,
150152 } ) ;
151153
152154 this . _baseHash = stableHash ( [
@@ -156,7 +158,7 @@ class Bundler {
156158 opts . minifierPath ,
157159 ] ) . toString ( 'binary' ) ;
158160
159- this . _projectRoots = opts . projectRoots ;
161+ this . _projectRoot = opts . projectRoot ;
160162 this . _getTransformOptions = opts . getTransformOptions ;
161163 }
162164
@@ -205,7 +207,7 @@ class Bundler {
205207 } {
206208 return {
207209 enableBabelRCLookup : this . _opts . enableBabelRCLookup ,
208- projectRoot : this . _projectRoots [ 0 ] ,
210+ projectRoot : this . _projectRoot ,
209211 } ;
210212 }
211213
@@ -241,7 +243,7 @@ class Bundler {
241243 }
242244 }
243245
244- const localPath = toLocalPath ( this . _projectRoots , filePath ) ;
246+ const localPath = toLocalPath ( this . _opts . watchFolders , filePath ) ;
245247
246248 const partialKey = stableHash ( [
247249 // This is the hash related to the global Bundler config.
0 commit comments