@@ -39,7 +39,8 @@ export class PlatformService extends EventEmitter implements IPlatformService {
3939 private $npm : INodePackageManager ,
4040 private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
4141 private $projectChangesService : IProjectChangesService ,
42- private $analyticsService : IAnalyticsService ) {
42+ private $analyticsService : IAnalyticsService ,
43+ private $nodeModulesDependenciesBuilder : INodeModulesDependenciesBuilder ) {
4344 super ( ) ;
4445 }
4546
@@ -223,13 +224,17 @@ export class PlatformService extends EventEmitter implements IPlatformService {
223224 let platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
224225 await this . $pluginsService . validate ( platformData , projectData ) ;
225226
227+ const bundle = appFilesUpdaterOptions . bundle ;
228+
226229 await this . ensurePlatformInstalled ( platform , platformTemplate , projectData , config ) ;
227- let changesInfo = this . $projectChangesService . checkForChanges ( platform , projectData , { bundle : appFilesUpdaterOptions . bundle , release : appFilesUpdaterOptions . release , provision : config . provision } ) ;
230+ let changesInfo = this . $projectChangesService . checkForChanges ( platform , projectData , { bundle, release : appFilesUpdaterOptions . release , provision : config . provision } ) ;
228231
229232 this . $logger . trace ( "Changes info in prepare platform:" , changesInfo ) ;
230233
231234 if ( changesInfo . hasChanges ) {
232235 await this . cleanProject ( platform , appFilesUpdaterOptions , platformData , projectData ) ;
236+ }
237+ if ( changesInfo . hasChanges || bundle ) {
233238 await this . preparePlatformCore ( platform , appFilesUpdaterOptions , projectData , config , changesInfo , filesToSync ) ;
234239 this . $projectChangesService . savePrepareInfo ( platform , projectData ) ;
235240 } else {
@@ -302,6 +307,16 @@ export class PlatformService extends EventEmitter implements IPlatformService {
302307
303308 if ( ! changesInfo || changesInfo . modulesChanged ) {
304309 await this . copyTnsModules ( platform , projectData ) ;
310+ } else if ( appFilesUpdaterOptions . bundle ) {
311+ let dependencies = this . $nodeModulesDependenciesBuilder . getProductionDependencies ( projectData . projectDir ) ;
312+ for ( let dependencyKey in dependencies ) {
313+ const dependency = dependencies [ dependencyKey ] ;
314+ let isPlugin = ! ! dependency . nativescript ;
315+ if ( isPlugin ) {
316+ let pluginData = this . $pluginsService . convertToPluginData ( dependency , projectData . projectDir ) ;
317+ await this . $pluginsService . preparePluginNativeCode ( pluginData , platform , projectData ) ;
318+ }
319+ }
305320 }
306321
307322 let directoryPath = path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ;
0 commit comments