我正在关注他们网站上的webpack教程。我的配置目前看起来像这样:
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
module.exports = {
entry: {
app: "./src/index.js",
print: "./src/print.js"
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist")
},
plugins: [new CleanWebpackPlugin(), new HtmlWebpackPlugin()],
module: {
rules: [
{
test: /\.css/,
use: ["style-loader", "css-loader"]
},
{
test: /\.(png|svg|jpg|gif)$/,
use: ["file-loader"]
},
{
test: /.(woff|woff2|eot|ttf|otf|)$/,
use: ["file-loader"]
},
{
test: /\.(csv|tsv)$/,
use: ["csv-loader"]
},
{
test: /\.xml$/,
use: ["xml-loader"]
}
]
}
};
运行webpack之后,这是我在/ dist上获得的html
文件:
8882716734208b988fc2b6fb432d60c8.ejs<script type="text/javascript" src="app.bundle.js"></script><script type="text/javascript" src="print.bundle.js"></script>
我确实看到了假定的模板文件...我在想我需要安装ejs(我以前从未做过)并为此添加配置?我目前不知道该怎么办...