Skip to content

Commit

Permalink
refactor(plugin-webpack): cast HtmlWebpackPlugin as webpack.Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Feb 2, 2020
1 parent 63e52f0 commit 2ab4a76
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/plugin/webpack/src/WebpackConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ export default class WebpackConfigGenerator {
}

const defines = this.getDefines(false);
const plugins = entryPoints.filter((entryPoint) => Boolean(entryPoint.html))
.map((entryPoint) => new HtmlWebpackPlugin({
title: entryPoint.name,
template: entryPoint.html,
filename: `${entryPoint.name}/index.html`,
chunks: [entryPoint.name].concat(entryPoint.additionalChunks || []),
}) as webpack.Plugin).concat([new webpack.DefinePlugin(defines)])
.concat(this.isProd ? [] : [new webpack.HotModuleReplacementPlugin()]);
return webpackMerge.smart({
entry,
devtool: 'inline-source-map',
Expand All @@ -212,14 +220,7 @@ export default class WebpackConfigGenerator {
__dirname: false,
__filename: false,
},
plugins: entryPoints.filter((entryPoint) => Boolean(entryPoint.html))
.map((entryPoint) => new HtmlWebpackPlugin({
title: entryPoint.name,
template: entryPoint.html,
filename: `${entryPoint.name}/index.html`,
chunks: [entryPoint.name].concat(entryPoint.additionalChunks || []),
})).concat([new webpack.DefinePlugin(defines)])
.concat(this.isProd ? [] : [new webpack.HotModuleReplacementPlugin()]),
plugins,
}, rendererConfig);
}
}

0 comments on commit 2ab4a76

Please sign in to comment.