ejs文件配置如下:
<!DOCTYPE html> <html lang="zh-CN"> <head> <title>webpack App</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="<%= htmlwebpackPlugin.files.css[0] %>"> </head> <body> <div id="app"></div> <script type="text/javascript" src="<%= htmlwebpackPlugin.files.js[0] %>"></script> </body> </html>
运行:
npm run build
报错如下:
解决方法:
ejs文件配置中得htmlwebpackPlugin修改为htmlWebpackPlugin