1

如何强制 CLI 将脚本标签注入头部而不是正文?

AngularCLI 6 以后不再弹出 webpack。所以我开始探索 angular.json,它基本上是 angular-cli.json 的替代品。

在以前的版本( 1.6.0 )中,我接近这个的方式是我弹出到 webpack 并且在 webpack 中我使用 HTMLWebpackPlugin 来强制将脚本注入头部。这很好用。

new HtmlWebpackPlugin({
"template": "./src/index.html",
"filename": "./index.html",
"hash": false,
<i>"inject": "head",</i>
"compile": true,
...

现在使用 angular cli 6.0 或 7.0,因为我们不能再弹出 webpack,我该如何实现。我在 angular.json 文件中没有看到任何注入选项。

请帮忙。

4

0 回答 0