11"use strict" ;
22
3- let BasicBundle = require ( "./basic" ) ;
3+ let generateBundle = require ( "./bundler" ) ;
4+ let generateConfig = require ( "./config" ) ;
5+ let { generateError } = require ( "../util" ) ;
46
5- module . exports = class Bundle extends BasicBundle {
7+ module . exports = class Bundle {
68 constructor ( entryPoint , target , config , { browsers } ) {
79 // extract bundle-specific fingerprinting, if any
810 config = Object . assign ( { } , config ) ;
911 if ( config . fingerprint !== undefined ) {
1012 var fingerprint = config . fingerprint ; // eslint-disable-line no-var
1113 delete config . fingerprint ;
1214 }
13- super ( config , { browsers } ) ;
15+ this . _config = generateConfig ( config , { browsers } ) ;
1416
1517 this . entryPoint = entryPoint ;
1618 this . target = target ;
@@ -31,6 +33,15 @@ module.exports = class Bundle extends BasicBundle {
3133 return false ;
3234 }
3335
34- return super . compile ( this . entryPoint ) ;
36+ return generateBundle ( this . entryPoint , this . _config , this . _cache ) .
37+ then ( ( { code, modules, cache } ) => {
38+ this . _modules = modules ;
39+ this . _cache = cache ;
40+ return { code } ;
41+ } , err => ( {
42+ // also report error from within bundle, to avoid it being overlooked
43+ code : generateError ( err ) ,
44+ error : err
45+ } ) ) ;
3546 }
3647} ;
0 commit comments