gpt4 book ai didi

javascript - 将外部js文件包含在(webpack和vue2)中的最佳方法是什么

转载 作者:行者123 更新时间:2023-11-28 10:43:19 25 4
gpt4 key购买 nike

我刚刚使用webpack2和vue2开发了该项目。我有其他外部插件无法通过 npm 安装。所以我的问题是包含这些文件的最佳方式。这是我的 index.html

<html>
<head>
</head>
<body>
<div id="app"></div>
<script src="app.js"></script>
<script src="/static/js/flowchart.js"></script>
<script src="/static/js/exteral2.js"></script>
</body>
</html>

这是我的index.html,其中包含一些外部js 文件。我们可以做一些捆绑,这样我们就不需要将这些外部文件包含到index.html中,或者这是包含外部js文件的唯一方法。

任何帮助将不胜感激。谢谢

最佳答案

在具有相对路径的代码中包含外部文件:

import './static/js/flowchart.js';

关于javascript - 将外部js文件包含在(webpack和vue2)中的最佳方法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48113630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com