File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -103,15 +103,23 @@ export default (options = {}) => {
103103 async generateBundle ( opts , bundle ) {
104104 if ( extracted . size === 0 ) return
105105
106+ // TODO: support `[hash]`
106107 const dir = opts . dir || path . dirname ( opts . file )
108+ const file =
109+ opts . file ||
110+ path . join (
111+ opts . dir ,
112+ Object . keys ( bundle ) . find ( fileName => bundle [ fileName ] . isEntry )
113+ )
107114 const getExtracted = ( ) => {
108115 const fileName =
109116 typeof postcssLoaderOptions . extract === 'string' ?
110117 path . relative ( dir , postcssLoaderOptions . extract ) :
111- `${ path . basename ( opts . file , path . extname ( opts . file ) ) } .css`
118+ `${ path . basename ( file , path . extname ( file ) ) } .css`
112119 const concat = new Concat ( true , fileName , '\n' )
113120 const entries = Array . from ( extracted . values ( ) )
114- const { modules } = bundle [ path . relative ( dir , opts . file ) ]
121+ const { modules } = bundle [ path . relative ( dir , file ) ]
122+
115123 if ( modules ) {
116124 const fileList = Object . keys ( modules )
117125 entries . sort (
You can’t perform that action at this time.
0 commit comments