@@ -3,8 +3,13 @@ import * as path from 'path';
3
3
import { GlobCopyWebpackPlugin } from '../../plugins/glob-copy-webpack-plugin' ;
4
4
import { packageChunkSort } from '../../utilities/package-chunk-sort' ;
5
5
import { BaseHrefWebpackPlugin } from '../../lib/base-href-webpack' ;
6
- import { extraEntryParser , lazyChunksFilter , getOutputHashFormat } from './utils' ;
7
6
import { WebpackConfigOptions } from '../webpack-config' ;
7
+ import {
8
+ extraEntryParser ,
9
+ lazyChunksFilter ,
10
+ getOutputHashFormat ,
11
+ getBundleOutputPath ,
12
+ } from './utils' ;
8
13
9
14
const autoprefixer = require ( 'autoprefixer' ) ;
10
15
const ProgressPlugin = require ( 'webpack/lib/ProgressPlugin' ) ;
@@ -96,18 +101,32 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
96
101
output : {
97
102
path : path . resolve ( projectRoot , buildOptions . outputPath ) ,
98
103
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`
101
106
} ,
102
107
module : {
103
108
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
+ } ,
108
127
{
109
128
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`
111
130
}
112
131
] . concat ( extraRules )
113
132
} ,
0 commit comments