我使用webpack 4,现在我的dist/loginPage/index.html
输入/输出,我想在另一个文件夹module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
main: './src/main.js',
loginPage: './src/loginPage/loginPage.js',
},
plugins: [
new CleanWebpackPlugin(['dist'], {
root: path.join(__dirname, '..'),
}),
new extractTextPlugin({
filename: 'bundle.css',
disable: false,
allChunks: true,
}),
new HtmlWebpackPlugin({
template: './src/index.ejs',
hash: true,
}),
// generate Login Page
new HtmlWebpackPlugin({
template: './src/loginPage/index.ejs',
hash: true,
}),
],
output: {
filename: '[name].[chunkhash].js',
path: path.resolve(__dirname, '../dist'),
publicPath: '/',
},
module: {
rules:[
{
test: /\.html$/,
exclude: /node_modules/,
use: 'file-loader?name=[name].[ext]',
},
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader?name=fonts/[name].[ext]',
},
],
},
performance: {hints: false},
optimization: {splitChunks: {chunks: 'all'}},
}
中提取另外一个index.html的文件夹。在我的dist我现在有:
我的webpack配置:
html-webpack-plugin
我使用{{1}}生成多个html文件。如何生成其中一个以使用loginPage / index.html
分隔文件夹