javascript - What is best way to include external js files in (webpack and vue2) - Stack Overflow

I just developed the project using webpack2 and vue2. I have other external plugins which cannot be ins

I just developed the project using webpack2 and vue2. I have other external plugins which cannot be installed through npm. So my question is the best way to include these files. Here are my 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>

this is my index.html whare I include some external js files. Can we do some bundling so that we dont need to include these external files to index.html or this is the only way to include external js files.

Any help would be highly appreciated. Thanks

I just developed the project using webpack2 and vue2. I have other external plugins which cannot be installed through npm. So my question is the best way to include these files. Here are my 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>

this is my index.html whare I include some external js files. Can we do some bundling so that we dont need to include these external files to index.html or this is the only way to include external js files.

Any help would be highly appreciated. Thanks

Share Improve this question asked Jan 5, 2018 at 12:26 Amit SharmaAmit Sharma 2,4873 gold badges21 silver badges26 bronze badges 1
  • Possible duplicate of How to include external file with webpack – Liam Commented Jan 5, 2018 at 12:41
Add a ment  | 

2 Answers 2

Reset to default 1

Include external file in code with relative path:

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

Usually you can do this by just importing the external js files into your *.vue file like this:

import './external/js/.js';

But in Webpacka you need to not parse these files as modules:
https://github./webpack/webpack.js/issues/63

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745391472a4625679.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信