@@ -57,6 +57,10 @@ module.exports = env => {
5757
5858 const entryModule = nsWebpack . getEntryModule ( appFullPath ) ;
5959 const entryPath = `.${ sep } ${ entryModule } ` ;
60+ const entries = { bundle : entryPath } ;
61+ if ( platform === "ios" ) {
62+ entries [ "tns_modules/tns-core-modules/inspector_modules" ] = "inspector_modules.js" ;
63+ } ;
6064 console . log ( `Bundling application for entryPath ${ entryPath } ...` ) ;
6165
6266 const config = {
@@ -72,9 +76,7 @@ module.exports = env => {
7276 } ,
7377 target : nativescriptTarget ,
7478 // target: nativeScriptVueTarget,
75- entry : {
76- bundle : entryPath ,
77- } ,
79+ entry : entries ,
7880 output : {
7981 pathinfo : false ,
8082 path : dist ,
@@ -114,6 +116,7 @@ module.exports = env => {
114116 } ,
115117 devtool : sourceMap ? "inline-source-map" : "none" ,
116118 optimization : {
119+ runtimeChunk : "single" ,
117120 splitChunks : {
118121 cacheGroups : {
119122 vendor : {
@@ -217,23 +220,23 @@ module.exports = env => {
217220 } ) ,
218221 // Remove all files from the out dir.
219222 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- } ] ) ,
226223 // Copy assets to out dir. Add your own globs as needed.
227224 new CopyWebpackPlugin ( [
228225 { from : { glob : "fonts/**" } } ,
229226 { from : { glob : "**/*.+(jpg|png)" } } ,
230227 { from : { glob : "assets/**/*" } } ,
231228 ] , { ignore : [ `${ relative ( appPath , appResourcesFullPath ) } /**` ] } ) ,
232229 // Generate a bundle starter script and activate it in package.json
233- new nsWebpack . GenerateBundleStarterPlugin ( [
234- "./vendor" ,
235- "./bundle" ,
236- ] ) ,
230+ new nsWebpack . GenerateBundleStarterPlugin (
231+ // Don't include `runtime.js` when creating a snapshot. The plugin
232+ // configures the WebPack runtime to be generated inside the snapshot
233+ // module and no `runtime.js` module exist.
234+ ( snapshot ? [ ] : [ "./runtime" ] )
235+ . concat ( [
236+ "./vendor" ,
237+ "./bundle" ,
238+ ] )
239+ ) ,
237240 // For instructions on how to set up workers with webpack
238241 // check out https://github.com/nativescript/worker-loader
239242 new NativeScriptWorkerPlugin ( ) ,
@@ -246,6 +249,18 @@ module.exports = env => {
246249 ] ,
247250 } ;
248251
252+ // Copy the native app resources to the out dir
253+ // only if doing a full build (tns run/build) and not previewing (tns preview)
254+ if ( ! externals || externals . length === 0 ) {
255+ config . plugins . push ( new CopyWebpackPlugin ( [
256+ {
257+ from : `${ appResourcesFullPath } /${ appResourcesPlatformDir } ` ,
258+ to : `${ dist } /App_Resources/${ appResourcesPlatformDir } ` ,
259+ context : projectRoot
260+ } ,
261+ ] ) ) ;
262+ }
263+
249264 if ( report ) {
250265 // Generate report files for bundles content
251266 config . plugins . push ( new BundleAnalyzerPlugin ( {
0 commit comments