3

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

Amit Sharma
  • 2,297
  • 3
  • 19
  • 25
  • Possible duplicate of [How to include external file with webpack](https://stackoverflow.com/questions/28964886/how-to-include-external-file-with-webpack) – Liam Jan 05 '18 at 12:41

2 Answers2

0

Include external file in code with relative path:

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

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.com/webpack/webpack.js.org/issues/63

Dabbas
  • 3,112
  • 7
  • 42
  • 75