有没有办法让webpack将输出注入HTML而不是单独的文件中?
<html>
<head>
</head>
<body>
<script type="text/javascript">
// webpack puts the output here
</script>
</body>
</html>
答案 0 :(得分:1)
我不得不使用html-webpack-inline-source-plugin
。 https://github.com/DustinJackson/html-webpack-inline-source-plugin
plugins: [
new HtmlWebpackPlugin({
inlineSource: '.(js|css)$' // embed all javascript and css inline
}),
new HtmlWebpackInlineSourcePlugin()
]