@@ -87,13 +87,13 @@ class Config {
8787 }
8888
8989 get buildPath ( ) {
90- return utils . normalizeBuildPath ( this . config . buildPath , this . baseDir ) ;
90+ const buildPath = this . utils . getOutputPath ( this . config ) ;
91+ return utils . normalizeBuildPath ( buildPath , this . baseDir ) ;
9192 }
9293
9394 get publicPath ( ) {
94- const config = this . config ;
9595 const host = this . host ;
96- const publicPath = config . publicPath . replace ( / \/ $ / , '' ) ;
96+ const publicPath = this . utils . getOutputPublicPath ( this . config ) ;
9797 if ( this . utils . isHttpOrHttps ( publicPath ) ) {
9898 return this . utils . normalizePublicPath ( publicPath ) ;
9999 }
@@ -106,7 +106,7 @@ class Config {
106106 get host ( ) {
107107 let host = '' ;
108108 const config = this . config ;
109- const configPublicPath = config . publicPath . replace ( / \/ $ / , '' ) ;
109+ const configPublicPath = this . utils . getOutputPublicPath ( this . config ) ;
110110 const cdnUrl = this . getPublicPathFromCDN ( config . cdn ) . replace ( / \/ $ / , '' ) ;
111111 if ( cdnUrl ) {
112112 if ( cdnUrl . endsWith ( configPublicPath ) ) {
@@ -172,11 +172,17 @@ class Config {
172172 if ( this . _loaderOptions ) {
173173 return this . _loaderOptions ;
174174 }
175- this . _loaderOptions = this . merge ( this . config . loaderOptions , this . loaders . options ) ;
176- return this . _loaderOptions ;
175+ const loader = this . getConfigLoaderByName ( 'options' ) ;
176+ if ( this . utils . isObject ( loader ) ) {
177+ if ( loader . hasOwnProperty ( 'options' ) ) {
178+ this . _loaderOptions = loader . options ;
179+ } else {
180+ this . _loaderOptions = loader ;
181+ }
182+ }
183+ return this . _loaderOptions || { } ;
177184 }
178185
179-
180186 initZero ( config ) {
181187 if ( this . egg ) {
182188 zero . initEggDefault ( config ) ;
@@ -271,7 +277,7 @@ class Config {
271277 analysisWebpackConfig ( config = { } ) {
272278 const webpackConfig = { } ;
273279 this . webpackNodeList . forEach ( key => {
274- if ( this . utils . has ( config , key ) ) {
280+ if ( config . hasOwnProperty ( key ) ) {
275281 const value = this . utils . get ( config , key ) ;
276282 this . utils . set ( webpackConfig , key , value ) ;
277283 }
@@ -601,7 +607,7 @@ class Config {
601607 }
602608
603609 getPublicPathFromCDN ( url , dynamicDir ) {
604- if ( ! this . dev && this . utils . has ( url ) ) {
610+ if ( ! this . dev && url ) {
605611 let cdnUrl = url ;
606612 let cdnDir = dynamicDir ;
607613 if ( this . utils . isObject ( url ) ) {
@@ -611,6 +617,7 @@ class Config {
611617 if ( cdnUrl ) {
612618 return cdnDir ? this . utils . joinPath ( cdnUrl , cdnDir ) : cdnUrl ;
613619 }
620+
614621 }
615622 return '' ;
616623 }
0 commit comments