This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +50
-31
lines changed Expand file tree Collapse file tree 5 files changed +50
-31
lines changed Original file line number Diff line number Diff line change @@ -243,14 +243,6 @@ module.exports = env => {
243243 } ) ,
244244 // Remove all files from the out dir.
245245 new CleanWebpackPlugin ( [ `${ dist } /**/*` ] ) ,
246- // Copy native app resources to out dir.
247- new CopyWebpackPlugin ( [
248- {
249- from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
250- to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
251- context : projectRoot
252- } ,
253- ] ) ,
254246 // Copy assets to out dir. Add your own globs as needed.
255247 new CopyWebpackPlugin ( [
256248 { from : { glob : "fonts/**" } } ,
@@ -277,6 +269,18 @@ module.exports = env => {
277269 ] ,
278270 } ;
279271
272+ // Copy the native app resources to the out dir
273+ // only if doing a full build (tns run/build) and not previewing (tns preview)
274+ if ( ! externals || externals . length === 0 ) {
275+ config . plugins . push ( new CopyWebpackPlugin ( [
276+ {
277+ from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
278+ to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
279+ context : projectRoot
280+ } ,
281+ ] ) ) ;
282+ }
283+
280284
281285 if ( report ) {
282286 // Generate report files for bundles content
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ describe('webpack.config.js', () => {
8383 } ) ;
8484
8585 it ( 'returns empty array when externals are not passed' , ( ) => {
86- const config = webpackConfig ( getInput ( { platform } ) ) ;
86+ const input = getInput ( { platform } ) ;
87+ const config = webpackConfig ( input ) ;
8788 expect ( config . externals ) . toEqual ( [ ] ) ;
8889 } ) ;
8990
Original file line number Diff line number Diff line change @@ -195,14 +195,6 @@ module.exports = env => {
195195 } ) ,
196196 // Remove all files from the out dir.
197197 new CleanWebpackPlugin ( [ `${ dist } /**/*` ] ) ,
198- // Copy native app resources to out dir.
199- new CopyWebpackPlugin ( [
200- {
201- from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
202- to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
203- context : projectRoot
204- } ,
205- ] ) ,
206198 // Copy assets to out dir. Add your own globs as needed.
207199 new CopyWebpackPlugin ( [
208200 { from : { glob : "fonts/**" } } ,
@@ -232,6 +224,18 @@ module.exports = env => {
232224 ] ,
233225 } ;
234226
227+ // Copy the native app resources to the out dir
228+ // only if doing a full build (tns run/build) and not previewing (tns preview)
229+ if ( ! externals || externals . length === 0 ) {
230+ config . plugins . push ( new CopyWebpackPlugin ( [
231+ {
232+ from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
233+ to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
234+ context : projectRoot
235+ } ,
236+ ] ) ) ;
237+ }
238+
235239 if ( report ) {
236240 // Generate report files for bundles content
237241 config . plugins . push ( new BundleAnalyzerPlugin ( {
Original file line number Diff line number Diff line change @@ -208,14 +208,6 @@ module.exports = env => {
208208 } ) ,
209209 // Remove all files from the out dir.
210210 new CleanWebpackPlugin ( [ `${ dist } /**/*` ] ) ,
211- // Copy native app resources to out dir.
212- new CopyWebpackPlugin ( [
213- {
214- from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
215- to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
216- context : projectRoot
217- } ,
218- ] ) ,
219211 // Copy assets to out dir. Add your own globs as needed.
220212 new CopyWebpackPlugin ( [
221213 { from : { glob : "fonts/**" } } ,
@@ -245,6 +237,18 @@ module.exports = env => {
245237 ] ,
246238 } ;
247239
240+ // Copy the native app resources to the out dir
241+ // only if doing a full build (tns run/build) and not previewing (tns preview)
242+ if ( ! externals || externals . length === 0 ) {
243+ config . plugins . push ( new CopyWebpackPlugin ( [
244+ {
245+ from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
246+ to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
247+ context : projectRoot
248+ } ,
249+ ] ) ) ;
250+ }
251+
248252 if ( report ) {
249253 // Generate report files for bundles content
250254 config . plugins . push ( new BundleAnalyzerPlugin ( {
Original file line number Diff line number Diff line change @@ -217,12 +217,6 @@ module.exports = env => {
217217 } ) ,
218218 // Remove all files from the out dir.
219219 new CleanWebpackPlugin ( [ `${ dist } /**/*` ] ) ,
220- // Copy native app resources to out dir.
221- new CopyWebpackPlugin ( [ {
222- from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
223- to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
224- context : projectRoot ,
225- } ] ) ,
226220 // Copy assets to out dir. Add your own globs as needed.
227221 new CopyWebpackPlugin ( [
228222 { from : { glob : "fonts/**" } } ,
@@ -252,6 +246,18 @@ module.exports = env => {
252246 ] ,
253247 } ;
254248
249+ // Copy the native app resources to the out dir
250+ // only if doing a full build (tns run/build) and not previewing (tns preview)
251+ if ( ! externals || externals . length === 0 ) {
252+ config . plugins . push ( new CopyWebpackPlugin ( [
253+ {
254+ from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
255+ to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
256+ context : projectRoot
257+ } ,
258+ ] ) ) ;
259+ }
260+
255261 if ( report ) {
256262 // Generate report files for bundles content
257263 config . plugins . push ( new BundleAnalyzerPlugin ( {
You can’t perform that action at this time.
0 commit comments