File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
packages/plugin/webpack/src Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 1
- import { Configuration as RawWebpackConfiguration } from 'webpack' ;
1
+ import { Configuration as RawWebpackConfiguration , Output as WebpackOutput , Plugin as WebpackPlugin } from 'webpack' ;
2
2
import WebpackDevServer from 'webpack-dev-server' ;
3
3
import { ConfigurationFactory as WebpackConfigurationFactory } from './WebpackConfig' ;
4
+ import { HtmlWebpackPlugin } from 'html-webpack-plugin' ;
4
5
5
6
export interface WebpackPluginEntryPoint {
6
7
/**
@@ -48,6 +49,20 @@ export interface WebpackPluginEntryPoint {
48
49
* for all entries.
49
50
*/
50
51
nodeIntegration ?: boolean ;
52
+ /**
53
+ * Custom options to merge into the configuration passed to `HtmlWebpackPlugin`.
54
+ */
55
+ htmlOptions ?: Partial < HtmlWebpackPlugin . Options > ;
56
+ /**
57
+ * Plugins to include before `HtmlWebpackPlugin`; typically, HTML plugin add-ons will
58
+ * need to be placed here.
59
+ */
60
+ htmlPlugins ?: WebpackPlugin [ ] ;
61
+ /**
62
+ * Additional options to merge into the Webpack `output` configuration for this entry-
63
+ * point.
64
+ */
65
+ output ?: WebpackOutput ;
51
66
}
52
67
53
68
export interface WebpackPreloadEntryPoint {
Original file line number Diff line number Diff line change @@ -194,25 +194,26 @@ export default class WebpackConfigGenerator {
194
194
target : this . rendererTarget ( entryPoint ) ,
195
195
devtool : this . rendererSourceMapOption ,
196
196
mode : this . mode ,
197
- output : {
197
+ output : Object . assign ( entryPoint . output || { } , {
198
198
path : path . resolve ( this . webpackDir , 'renderer' ) ,
199
199
filename : '[name]/index.js' ,
200
200
globalObject : 'self' ,
201
201
...( this . isProd ? { } : { publicPath : '/' } ) ,
202
- } ,
202
+ } ) ,
203
203
node : {
204
204
__dirname : false ,
205
205
__filename : false ,
206
206
} ,
207
207
plugins : [
208
+ ...( entryPoint . htmlPlugins || [ ] ) ,
208
209
...( entryPoint . html
209
210
? [
210
- new HtmlWebpackPlugin ( {
211
+ new HtmlWebpackPlugin ( Object . assign ( { } , {
211
212
title : entryPoint . name ,
212
213
template : entryPoint . html ,
213
214
filename : `${ entryPoint . name } /index.html` ,
214
215
chunks : [ entryPoint . name ] . concat ( entryPoint . additionalChunks || [ ] ) ,
215
- } ) as WebpackPluginInstance ,
216
+ } , entryPoint . htmlOptions || { } ) ) as WebpackPluginInstance ,
216
217
]
217
218
: [ ] ) ,
218
219
new webpack . DefinePlugin ( defines ) ,
You can’t perform that action at this time.
0 commit comments