webpack4中在html頁面的<script>標簽里寫<%= %>會報下面的錯誤,大家有遇到嗎
The script element allows authors to include dynamic script and data blocks in their documents. The element does not represent content for the user.
The script element allows authors to include dynamic script and data blocks in their documents. The element does not represent content for the user.
2019-01-25
舉報
2019-04-06
webpack4 確實會報錯。
要把js弄成inline的話,有另一個方法,需要一個插件 叫:html-webpack-inline-source-plugin,用來將靜態資源inline注入。
安裝:
在webpack.config.js頭部寫上:
在需要inline的地方加上:
在plugins的最后加上:
之后,npm run webpack 打包一下就可以了。
2019-01-25
<%= 這里寫完整? ?%>