webpack4中在html頁面的<script>標(biāo)簽里寫<%= %>會報(bào)下面的錯(cuò)誤,大家有遇到嗎
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
舉報(bào)
2019-04-06
webpack4 確實(shí)會報(bào)錯(cuò)。
要把js弄成inline的話,有另一個(gè)方法,需要一個(gè)插件 叫:html-webpack-inline-source-plugin,用來將靜態(tài)資源inline注入。
安裝:
在webpack.config.js頭部寫上:
在需要inline的地方加上:
在plugins的最后加上:
之后,npm run webpack 打包一下就可以了。
2019-01-25
<%= 這里寫完整? ?%>