This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ const { RawSource } = require("webpack-sources");
22const { getPackageJson } = require ( "../projectHelpers" ) ;
33const { SNAPSHOT_ENTRY_NAME } = require ( "./NativeScriptSnapshotPlugin" ) ;
44
5+
56exports . GenerateNativeScriptEntryPointsPlugin = ( function ( ) {
7+ const GenerationFailedError = "Unable to generate entry files." ;
8+
69 function GenerateNativeScriptEntryPointsPlugin ( appEntryName ) {
710 this . appEntryName = appEntryName ;
811 this . files = { } ;
@@ -60,12 +63,18 @@ exports.GenerateNativeScriptEntryPointsPlugin = (function () {
6063 return requireChunkFiles ;
6164 } ) . join ( "" ) ;
6265
63- if ( entryChunk ) {
64- entryChunk . files . forEach ( fileName => {
65- const currentEntryFileContent = compilation . assets [ fileName ] . source ( ) ;
66- compilation . assets [ fileName ] = new RawSource ( `${ requireDeps } ${ currentEntryFileContent } ` ) ;
67- } ) ;
66+ if ( ! entryChunk ) {
67+ throw new Error ( `${ GenerationFailedError } Entry chunk not found for entry "${ entryPointName } ".` ) ;
6868 }
69+
70+ entryChunk . files . forEach ( fileName => {
71+ if ( ! compilation . assets [ fileName ] ) {
72+ throw new Error ( `${ GenerationFailedError } File "${ fileName } " not found for entry "${ entryPointName } ".` ) ;
73+ }
74+
75+ const currentEntryFileContent = compilation . assets [ fileName ] . source ( ) ;
76+ compilation . assets [ fileName ] = new RawSource ( `${ requireDeps } ${ currentEntryFileContent } ` ) ;
77+ } ) ;
6978 }
7079
7180 GenerateNativeScriptEntryPointsPlugin . prototype . addAsset = function ( compilation , name , content ) {
You can’t perform that action at this time.
0 commit comments