@@ -167,8 +167,13 @@ function (file, pragma, parse) {
167
167
//and to make sure this file is first, so that define calls work.
168
168
//This situation mainly occurs when the build is done on top of the output
169
169
//of another build, where the first build may include require somewhere in it.
170
- if ( ! layer . existingRequireUrl && parse . definesRequire ( url , contents ) ) {
171
- layer . existingRequireUrl = url ;
170
+ try {
171
+ if ( ! layer . existingRequireUrl && parse . definesRequire ( url , contents ) ) {
172
+ layer . existingRequireUrl = url ;
173
+ }
174
+ } catch ( e1 ) {
175
+ throw new Error ( 'Parse error using UglifyJS ' +
176
+ 'for file: ' + url + '\n' + e1 ) ;
172
177
}
173
178
174
179
if ( moduleName in context . plugins ) {
@@ -185,12 +190,17 @@ function (file, pragma, parse) {
185
190
//Parse out the require and define calls.
186
191
//Do this even for plugins in case they have their own
187
192
//dependencies that may be separate to how the pluginBuilder works.
188
- if ( ! context . needFullExec [ moduleName ] ) {
189
- contents = parse ( moduleName , url , contents , {
190
- insertNeedsDefine : true ,
191
- has : context . config . has ,
192
- findNestedDependencies : context . config . findNestedDependencies
193
- } ) ;
193
+ try {
194
+ if ( ! context . needFullExec [ moduleName ] ) {
195
+ contents = parse ( moduleName , url , contents , {
196
+ insertNeedsDefine : true ,
197
+ has : context . config . has ,
198
+ findNestedDependencies : context . config . findNestedDependencies
199
+ } ) ;
200
+ }
201
+ } catch ( e2 ) {
202
+ throw new Error ( 'Parse error using UglifyJS ' +
203
+ 'for file: ' + url + '\n' + e2 ) ;
194
204
}
195
205
196
206
require . _cachedFileContents [ url ] = contents ;
0 commit comments