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>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf31a1-315d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf31a1-315d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?