WEBPACK.CONFIG.JS
1.使用UMD
module.exports={
            mode:'development',
            entry:'./yourentry.js',
            output:{
                path:path.resolve(__dirname,"dist"),
                filename:'main.js',
                publicPath:'/dist/',
                libraryTarget:'umd', 
                library:'rstate',
                umdNamedDefine: true,
                libraryExport: 'default' 
            }
    }
索引.html
<script src="dist/main.js"></script>
<script>
  window.onload = function () {
  rstate()=>{}
</script>
主文件
export default function rstate(){
console.log("i called from html")
}
2.使用VAR
module.exports={
            mode:'development',
            entry:'./yourentry.js',
            output:{
                path:path.resolve(__dirname,"dist"),
                filename:'main.js',
                publicPath:'/dist/',
                libraryTarget:'var', 
                library: 'EntryPoint'
            }
    }
索引.html
<script>
  window.onload = function () {
  EntryPoint.rstate()=>{}
</script>
主文件
module.exports={
    rstate=function(){
        console.log("hi module")
    }
}
3.USING AMD as library we used like (for those who want to make lib)
define(['jquery', './aux-lib.js'], function ($) { ..(1).. });