1- const { resolve, join } = require ( "path" ) ;
1+ const { relative , resolve, join } = require ( "path" ) ;
22
33const webpack = require ( "webpack" ) ;
44const nsWebpack = require ( "nativescript-dev-webpack" ) ;
@@ -15,13 +15,14 @@ module.exports = env => {
1515 throw new Error ( "You need to provide a target platform!" ) ;
1616 }
1717
18+ const platforms = [ "ios" , "android" ] ;
1819 const projectRoot = __dirname ;
1920 // Default destination inside platforms/<platform>/...
2021 const dist = resolve ( projectRoot , nsWebpack . getAppPath ( platform ) ) ;
22+ const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS" ;
2123
22- const platforms = [ "ios" , "android" ] ;
2324 const {
24- // The 'appPath' and 'appResourcesDir ' values are fetched from
25+ // The 'appPath' and 'appResourcesPath ' values are fetched from
2526 // the nsconfig.json configuration file
2627 // when bundling with `tns run android|ios --bundle`.
2728 appPath = "app" ,
@@ -128,14 +129,21 @@ module.exports = env => {
128129 } ) ,
129130 // Remove all files from the out dir.
130131 new CleanWebpackPlugin ( [ `${ dist } /**/*` ] ) ,
132+ // Copy native app resources to out dir.
133+ new CopyWebpackPlugin ( [
134+ {
135+ from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
136+ to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
137+ context : projectRoot
138+ } ,
139+ ] ) ,
131140 // Copy assets to out dir. Add your own globs as needed.
132141 new CopyWebpackPlugin ( [
133- { from : `${ appResourcesFullPath } /**` , context : projectRoot } ,
134142 { from : "fonts/**" } ,
135143 { from : "**/*.jpg" } ,
136144 { from : "**/*.png" } ,
137145 { from : "**/*.xml" } ,
138- ] ) ,
146+ ] , { ignore : [ ` ${ relative ( appPath , appResourcesFullPath ) } /**` ] } ) ,
139147 // Generate a bundle starter script and activate it in package.json
140148 new nsWebpack . GenerateBundleStarterPlugin ( [
141149 "./vendor" ,
0 commit comments