[英]How to automatically include NPM “dependencies” into index.html through <script> tags in VUE JS WEBPACK project?
I know there is a GRUNT-BOWER plugin which automatically includes the BOWER dependencies into index.html file through tags every time you install any new bower package. 我知道有一个GRUNT-BOWER插件,每次安装任何新的bower包时,都会通过标签自动将BOWER依赖项包含到index.html文件中。
Is there any similar tool which automatically Injects / includes the NPM dependencies into index.html ? 是否有任何类似的工具可以自动注入/包含NPM依赖关系到index.html?
FYI the project is a VUE-CLI WEBPACK project. 仅供参考,该项目是VUE-CLI WEBPACK项目。 Can this be achieved through WEBPACK or do i need a dedicated build tool for doing it ?
这可以通过WEBPACK实现还是需要专用的构建工具来实现呢?
If you're using already using webpack you can have a look at html-webpack-plugin . 如果您已经在使用webpack,可以查看html-webpack-plugin 。 It will create a
.html
file with your bundles added as script tags. 它将创建一个
.html
文件,并将您的包添加为脚本标记。
html-webpack-plugin in conjunction with creating a vendor bundle should help with this problem. html-webpack-plugin与创建供应商包相结合应该有助于解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.