简体   繁体   English

如何通过自动将NPM“依赖”包含到index.html中<script> tags in VUE JS WEBPACK project?

[英]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.

相关问题 在对AngularJS应用进行模块化之后,如何将整个项目包含在index.html中,而不必键入很多<script> tags - After modularizing an AngularJS app, how do you include the entire project in the index.html without having to type a ton of <script> tags WebPack 反复将冗余脚本标签注入 index.html 加载 - WebPack repeatedly injects redundant script tags into index.html on load Webpack - 如何包含。html 片段进入索引。html 实时重新加载? - Webpack - How to include .html fragments into index.html with live reloading? main.js如何链接到Vue-cli webpack模板中的Index.html - How does main.js link to Index.html in Vue-cli webpack template 如何使 Vue 从 assets 文件夹中导入文件,而不是 index.html 内的硬编码脚本标签 - How to make Vue import files from assets folder instead of hardcoded script tags inside of index.html 这将如何工作...... npm 与 index.js 和 index.html? - How this will work... npm with index.js and index.html? 如何在 index.html 的外部脚本中添加额外的动态参数? (Vue.js) - How to add additional dynamic params to the external script in index.html? (Vue.js) 如何从index.html访问webpack生成的js文件 - How to access webpack generated js file from index.html 如何在脚本标签的index.html中使用Bowser Javascript库? - How to use a Bowser Javascript Library in index.html in script tags? Vue.js / Webpack 使用 CSS 和 JS 的“静态”子域构建“index.html” - Vue.js / Webpack build “index.html” using a “static” subdomain for CSS and JS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM