In webpack dev mode, how to introduce the script tag of js into index.html

We are now using the vue+webpack framework, and then there is a requirement that we need to dynamically load the component module returned by the server, this module includes js/json/vue/less and other format files, so I thought of using requirejs, to pull down all the components through the server interface, then define each component, and then require the component through requirejs"s data-main.

the problem now is that I don"t know how to introduce static js files such as requirejs in dev mode. What should be the relative path of its file

Thank you all!


  1. as long as you know what kind of absolute path can be taken, you can use the relative path to get it. Absolute path = current path + relative path.
  2. dynamic loading is better than using code split + lazy loading.

answer for yourself

actually just want to get static js files through the script tag, copy the files to the static directory via CopyWebpackPlugin , and webpack-dev-server can also get these files.

so easyweights! That's about what it looks like:

</script>
Menu