@@ -4,7 +4,7 @@ import { hook } from "../common/helpers";
4
4
import { performanceLog } from "../common/decorators" ;
5
5
import { EventEmitter } from "events" ;
6
6
import * as path from "path" ;
7
- import { PREPARE_READY_EVENT_NAME , WEBPACK_COMPILATION_COMPLETE , PACKAGE_JSON_FILE_NAME } from "../constants" ;
7
+ import { PREPARE_READY_EVENT_NAME , WEBPACK_COMPILATION_COMPLETE , PACKAGE_JSON_FILE_NAME , PLATFORMS_DIR_NAME } from "../constants" ;
8
8
9
9
interface IPlatformWatcherData {
10
10
webpackCompilerProcess : child_process . ChildProcess ;
@@ -20,6 +20,7 @@ export class PrepareController extends EventEmitter {
20
20
private $platformController : IPlatformController ,
21
21
public $hooksService : IHooksService ,
22
22
private $logger : ILogger ,
23
+ private $nodeModulesDependenciesBuilder : INodeModulesDependenciesBuilder ,
23
24
private $platformsDataService : IPlatformsDataService ,
24
25
private $prepareNativePlatformService : IPrepareNativePlatformService ,
25
26
private $projectChangesService : IProjectChangesService ,
@@ -141,12 +142,15 @@ export class PrepareController extends EventEmitter {
141
142
142
143
@hook ( 'watchPatterns' )
143
144
public async getWatcherPatterns ( platformData : IPlatformData , projectData : IProjectData ) : Promise < string [ ] > {
145
+ const pluginsNativeDirectories = this . $nodeModulesDependenciesBuilder . getProductionDependencies ( projectData . projectDir )
146
+ . filter ( dep => dep . nativescript )
147
+ . map ( dep => path . join ( dep . directory , PLATFORMS_DIR_NAME , platformData . platformNameLowerCase ) ) ;
148
+
144
149
const patterns = [
145
150
path . join ( projectData . projectDir , PACKAGE_JSON_FILE_NAME ) ,
146
151
path . join ( projectData . getAppDirectoryPath ( ) , PACKAGE_JSON_FILE_NAME ) ,
147
152
path . join ( projectData . getAppResourcesRelativeDirectoryPath ( ) , platformData . normalizedPlatformName ) ,
148
- `node_modules/**/platforms/${ platformData . platformNameLowerCase } /`
149
- ] ;
153
+ ] . concat ( pluginsNativeDirectories ) ;
150
154
151
155
return patterns ;
152
156
}
0 commit comments