我只想将 html-webpack-plugin用于我的 js 块。Bundle.css 由 extract-text-plugin 生成:
new ExtractTextPlugin({filename: 'bundle.css, allChunks: true})
HtmlWebpack插件选项:
new HtmlWebpackPlugin({template: 'template/tpl.html', inject: true})
我的 tpl.html 看起来像这样:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Cash Management</title>
<link href="getResource?resource=build/bundle.css&mediaType=text/css" rel="stylesheet">
</head>
<body>
<div id='root' />
</body>
</html>
我想在我的 index.html 中看到类似的内容:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Cash Management</title>
<link href="getResource?moduleName=cm-ui&resource=build/bundle.css&mediaType=text/css" rel="stylesheet">
</head>
<body>
<div id='root' />
</body>
<script href="getResource?moduleName=cm-ui&resource=build/common.js" type="text/javascript"></script>
<script href="getResource?moduleName=cm-ui&resource=build/bundle.js" type="text/javascript"></script>
</html>
有人可以指出我正确的方向吗?