mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
chore(deploy): use prod vue for prod bundle (#2389)
This commit is contained in:
parent
265a6e4c6d
commit
a01ad99b00
@ -9,6 +9,12 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|||||||
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||||
|
|
||||||
const isProd = process.env.NODE_ENV === 'production'
|
const isProd = process.env.NODE_ENV === 'production'
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 是否使用生产环境的 vue
|
||||||
|
*/
|
||||||
|
const isVueProd = process.env.VUE_BUNDLE === 'production' || isProd
|
||||||
|
const vueBundle = isVueProd ? 'vue.esm-browser.prod.js' : 'vue.esm-browser.js'
|
||||||
const isPlay = !!process.env.PLAY_ENV
|
const isPlay = !!process.env.PLAY_ENV
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
@ -63,7 +69,7 @@ const config = {
|
|||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.tsx', '.js', '.vue', '.json'],
|
extensions: ['.ts', '.tsx', '.js', '.vue', '.json'],
|
||||||
alias: {
|
alias: {
|
||||||
vue: 'vue/dist/vue.esm-browser.js',
|
vue: `vue/dist/${vueBundle}`,
|
||||||
examples: path.resolve(__dirname),
|
examples: path.resolve(__dirname),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -78,7 +84,9 @@ const config = {
|
|||||||
],
|
],
|
||||||
devServer: {
|
devServer: {
|
||||||
inline: true,
|
inline: true,
|
||||||
hot: true,
|
// 如果使用 vue 的生产环境构建包,无法启用 hmr
|
||||||
|
// 因为生产环境下 vue 没有注入 hmr 必须的 __VUE_HMR_RUNTIME__ api
|
||||||
|
hot: !isVueProd,
|
||||||
stats: 'minimal',
|
stats: 'minimal',
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
contentBase: __dirname,
|
contentBase: __dirname,
|
||||||
|
Loading…
Reference in New Issue
Block a user