children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + 'nn')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.n' +
' Opening index.html over file:// won't work.n'
))
})
})
从上面我们可以看出他其实用的就是我刚刚所解释的 webpack.prod.conf.js文件。
三、打包发布到云端以及nginx服务器配置
通过执行这个脚本文件我们可以得到我们所需要的dist打包文件,我这边使用的是部署在阿里云的nginx服务器,只需要配置下信息,重启nginx服务器就通过你的浏览器便可以访问了。
配置代码
server
{
listen 80;
server_name 网址名;
root 你的dist文件目录下文件;
index index.html ; if ($request_uri = '/index.php?route=account/reg/code') {
return 404;
}
error_log logs/error.log;
access_log logs/access.log;
}










