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 => {
243
243
} ) ,
244
244
// Remove all files from the out dir.
245
245
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
- ] ) ,
254
246
// Copy assets to out dir. Add your own globs as needed.
255
247
new CopyWebpackPlugin ( [
256
248
{ from : { glob : "fonts/**" } } ,
@@ -277,6 +269,18 @@ module.exports = env => {
277
269
] ,
278
270
} ;
279
271
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
+
280
284
281
285
if ( report ) {
282
286
// Generate report files for bundles content
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ describe('webpack.config.js', () => {
83
83
} ) ;
84
84
85
85
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 ) ;
87
88
expect ( config . externals ) . toEqual ( [ ] ) ;
88
89
} ) ;
89
90
Original file line number Diff line number Diff line change @@ -195,14 +195,6 @@ module.exports = env => {
195
195
} ) ,
196
196
// Remove all files from the out dir.
197
197
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
- ] ) ,
206
198
// Copy assets to out dir. Add your own globs as needed.
207
199
new CopyWebpackPlugin ( [
208
200
{ from : { glob : "fonts/**" } } ,
@@ -232,6 +224,18 @@ module.exports = env => {
232
224
] ,
233
225
} ;
234
226
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
+
235
239
if ( report ) {
236
240
// Generate report files for bundles content
237
241
config . plugins . push ( new BundleAnalyzerPlugin ( {
Original file line number Diff line number Diff line change @@ -208,14 +208,6 @@ module.exports = env => {
208
208
} ) ,
209
209
// Remove all files from the out dir.
210
210
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
- ] ) ,
219
211
// Copy assets to out dir. Add your own globs as needed.
220
212
new CopyWebpackPlugin ( [
221
213
{ from : { glob : "fonts/**" } } ,
@@ -245,6 +237,18 @@ module.exports = env => {
245
237
] ,
246
238
} ;
247
239
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
+
248
252
if ( report ) {
249
253
// Generate report files for bundles content
250
254
config . plugins . push ( new BundleAnalyzerPlugin ( {
Original file line number Diff line number Diff line change @@ -217,12 +217,6 @@ module.exports = env => {
217
217
} ) ,
218
218
// Remove all files from the out dir.
219
219
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
- } ] ) ,
226
220
// Copy assets to out dir. Add your own globs as needed.
227
221
new CopyWebpackPlugin ( [
228
222
{ from : { glob : "fonts/**" } } ,
@@ -252,6 +246,18 @@ module.exports = env => {
252
246
] ,
253
247
} ;
254
248
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
+
255
261
if ( report ) {
256
262
// Generate report files for bundles content
257
263
config . plugins . push ( new BundleAnalyzerPlugin ( {
You can’t perform that action at this time.
0 commit comments