@@ -82,6 +82,10 @@ class Config {
8282 return this . dev && this . utils . isTrue ( config . proxy ) ;
8383 }
8484
85+ get prefix ( ) {
86+ return this . config . prefix || '' ;
87+ }
88+
8589 get nativeWebpackConfig ( ) {
8690 return this . configList . reduce ( ( result , item ) => {
8791 return merge ( result , this . analysisWebpackConfig ( item ) ) ;
@@ -249,35 +253,35 @@ class Config {
249253
250254 createFileName ( config ) {
251255 if ( ( config . hash && this . utils . isTrue ( config . fileHash ) ) || config . fileHash ) {
252- this . setOutputFileName ( `js/[name].[chunkhash:${ config . hashLength } ].js` ) ;
253- this . setOutputFileChunkName ( `js/chunk/[name].[chunkhash:${ config . hashLength } ].js` )
256+ this . setOutputFileName ( utils . assetsPath ( this . prefix , `js/[name].[chunkhash:${ config . hashLength } ].js` ) ) ;
257+ this . setOutputFileChunkName ( utils . assetsPath ( this . prefix , `js/chunk/[name].[chunkhash:${ config . hashLength } ].js` ) ) ;
254258 } else {
255- this . setOutputFileName ( 'js/[name].js' ) ;
256- this . setOutputFileChunkName ( 'js/chunk/[name].js' ) ;
259+ this . setOutputFileName ( utils . assetsPath ( this . prefix , 'js/[name].js' ) ) ;
260+ this . setOutputFileChunkName ( utils . assetsPath ( this . prefix , 'js/chunk/[name].js' ) ) ;
257261 }
258262 }
259263
260264 createImageName ( config ) {
261265 if ( ( config . hash && this . utils . isTrue ( config . imageHash ) ) || config . imageHash ) {
262- this . webpackInfo . imageName = `img/[name].[hash:${ config . hashLength } ].[ext]` ;
266+ this . webpackInfo . imageName = utils . assetsPath ( this . prefix , `img/[name].[hash:${ config . hashLength } ].[ext]` ) ;
263267 } else {
264- this . webpackInfo . imageName = 'img/[name].[ext]' ;
268+ this . webpackInfo . imageName = utils . assetsPath ( this . prefix , 'img/[name].[ext]' ) ;
265269 }
266270 }
267271
268272 createCssName ( config ) {
269273 if ( ( config . hash && this . utils . isTrue ( config . cssHash ) ) || config . cssHash ) {
270- this . webpackInfo . cssName = `css/[name].[contenthash:${ config . hashLength } ].css` ;
274+ this . webpackInfo . cssName = utils . assetsPath ( this . prefix , `css/[name].[contenthash:${ config . hashLength } ].css` ) ;
271275 } else {
272- this . webpackInfo . cssName = 'css/[name].css' ;
276+ this . webpackInfo . cssName = utils . assetsPath ( this . prefix , 'css/[name].css' ) ;
273277 }
274278 }
275279
276280 createFrontName ( config ) {
277281 if ( ( config . hash && this . utils . isTrue ( config . fontHash ) ) || config . fontHash ) {
278- this . webpackInfo . frontName = `font/[name].[hash:${ config . hashLength } ].[ext]` ;
282+ this . webpackInfo . frontName = utils . assetsPath ( this . prefix , `font/[name].[hash:${ config . hashLength } ].[ext]` ) ;
279283 } else {
280- this . webpackInfo . frontName = 'font/[name].[ext]' ;
284+ this . webpackInfo . frontName = utils . assetsPath ( this . prefix , 'font/[name].[ext]' ) ;
281285 }
282286 }
283287
0 commit comments