@@ -3,8 +3,13 @@ import * as path from 'path';
33import { GlobCopyWebpackPlugin } from '../../plugins/glob-copy-webpack-plugin' ;
44import { packageChunkSort } from '../../utilities/package-chunk-sort' ;
55import { BaseHrefWebpackPlugin } from '../../lib/base-href-webpack' ;
6- import { extraEntryParser , lazyChunksFilter , getOutputHashFormat } from './utils' ;
76import { WebpackConfigOptions } from '../webpack-config' ;
7+ import {
8+ extraEntryParser ,
9+ lazyChunksFilter ,
10+ getOutputHashFormat ,
11+ getBundleOutputPath ,
12+ } from './utils' ;
813
914const autoprefixer = require ( 'autoprefixer' ) ;
1015const ProgressPlugin = require ( 'webpack/lib/ProgressPlugin' ) ;
@@ -96,18 +101,32 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
96101 output : {
97102 path : path . resolve ( projectRoot , buildOptions . outputPath ) ,
98103 publicPath : buildOptions . deployUrl ,
99- filename : `[name]${ hashFormat . chunk } .bundle.js` ,
100- chunkFilename : `[id]${ hashFormat . chunk } .chunk.js`
104+ filename : `${ appConfig . bundlesOutDir } / [name]${ hashFormat . chunk } .bundle.js` ,
105+ chunkFilename : `${ appConfig . bundlesOutDir } / [id]${ hashFormat . chunk } .chunk.js`
101106 } ,
102107 module : {
103108 rules : [
104- { enforce : 'pre' , test : / \. j s $ / , loader : 'source-map-loader' , exclude : [ nodeModules ] } ,
105- { test : / \. j s o n $ / , loader : 'json-loader' } ,
106- { test : / \. h t m l $ / , loader : 'raw-loader' } ,
107- { test : / \. ( e o t | s v g ) $ / , loader : `file-loader?name=[name]${ hashFormat . file } .[ext]` } ,
109+ {
110+ enforce : 'pre' ,
111+ test : / \. j s $ / ,
112+ loader : `source-map-loader?name=${ getBundleOutputPath ( appConfig ) } ` ,
113+ exclude : [ nodeModules ]
114+ } ,
115+ {
116+ test : / \. j s o n $ / ,
117+ loader : `json-loader?name=${ getBundleOutputPath ( appConfig ) } `
118+ } ,
119+ {
120+ test : / \. h t m l $ / ,
121+ loader : `raw-loader?name=${ getBundleOutputPath ( appConfig ) } `
122+ } ,
123+ {
124+ test : / \. ( e o t | s v g ) $ / ,
125+ loader : `file-loader?name=${ getBundleOutputPath ( appConfig , hashFormat ) } `
126+ } ,
108127 {
109128 test : / \. ( j p g | p n g | g i f | o t f | t t f | w o f f | w o f f 2 | c u r | a n i ) $ / ,
110- loader : `url-loader?name=[name] ${ hashFormat . file } .[ext] &limit=10000`
129+ loader : `url-loader?name=${ getBundleOutputPath ( appConfig , hashFormat ) } &limit=10000`
111130 }
112131 ] . concat ( extraRules )
113132 } ,
0 commit comments