天天看点

iview admin打包 -- 齐枭飞

在程序根目录右键打开cmd,输入

npm run build
           

这时就会进入打包的步骤,打包好之后就会在程序根目录出现一个dist的文件夹,里面有一个index.html文件和另一个dist的文件夹。

这里要说明几点:

最外层的dist文件夹不能用,要把index.html页面放到网站(web容器)的根目录。

删除webpack.base.config.js文件里面的

{
    test: /\.(html|tpl|ejs)$/,
    loader: 'html-loader'
}
           
  1. 修改webpack.prod.config.js文件output属性中的publicPath的值,写上服务器的域名或者IP。
output: {
    publicPath: 'http://10.1.2.4/dist/',  // 修改 https://iv...admin 这部分为你的服务器域名 
    filename: '[name].[hash].js',
    chunkFilename: '[name].[hash].chunk.js'
}