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");
2
2
const { getPackageJson } = require ( "../projectHelpers" ) ;
3
3
const { SNAPSHOT_ENTRY_NAME } = require ( "./NativeScriptSnapshotPlugin" ) ;
4
4
5
+
5
6
exports . GenerateNativeScriptEntryPointsPlugin = ( function ( ) {
7
+ const GenerationFailedError = "Unable to generate entry files." ;
8
+
6
9
function GenerateNativeScriptEntryPointsPlugin ( appEntryName ) {
7
10
this . appEntryName = appEntryName ;
8
11
this . files = { } ;
@@ -60,12 +63,18 @@ exports.GenerateNativeScriptEntryPointsPlugin = (function () {
60
63
return requireChunkFiles ;
61
64
} ) . join ( "" ) ;
62
65
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 } ".` ) ;
68
68
}
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
+ } ) ;
69
78
}
70
79
71
80
GenerateNativeScriptEntryPointsPlugin . prototype . addAsset = function ( compilation , name , content ) {
You can’t perform that action at this time.
0 commit comments