提交 aef63a2c authored 作者: zyx's avatar zyx

正在修改

上级 4a4731a0
module.exports = {
demain: 'dev.ezijing.com',
url: 'http://dev.ezijing.com:4002'
// apiBaseURL: '//demo-login.ezijing.com/'
}
module.exports = {
url: 'https://api.ezijing.com',
DesDir: '../client-dist',
apiBaseURL: '//api.ezijing.com/'
}
module.exports = {
url: 'https://login-pbcsf.ezijing.com',
DesDir: '../client-dist',
apiBaseURL: '//login-pbcsf.ezijing.com/'
}
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
"plugins": [ "plugins": [
"html" "html"
], ],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "babel-eslint", "parser": "babel-eslint",
"sourceType": "module"
},
"rules": { "rules": {
"no-new": "off", "no-new": "off",
"no-debugger": "off" "no-debugger": "off"
......
const isDev = process.env.NODE_ENV === 'development' const isDev = process.env.NODE_ENV
let config = { let config = {
ResName: 'client', isDev: isDev,
DesName: '../server/client-dist', ResDir: 'src',
HtmlPath: 'client/project/index.html', DesDir: '../client-dist',
JsPath: 'client/project/main.js',
IcoPath: 'client/project/assets/favicon.ico', HtmlPath: 'src/index.html',
isHttps: false, IcoPath: 'src/assets/favicon.ico',
JsPath: 'src/main.js',
isHttps: true,
CDN_BASE: 'https://zws-imgs-pub.ezijing.com/', CDN_BASE: 'https://zws-imgs-pub.ezijing.com/',
CDN_PATH: 'static/build/learn-mba/', CDN_DIR: 'static/build/learn-mba/',
isUploadStatic: false,
isUploadStatic: false webpack: {}
} }
if (isDev) { let vueClientConfig = {}
config.demain = 'dev.ezijing.com' config.domain = 'dev.ezijing.com'
config.url = 'http://dev.ezijing.com:4002' if (config.isDev === 'development') {
config.url = 'http://dev.ezijing.com:12002'
try {
vueClientConfig = require('../.config.dev.js')
} catch (error) {
vueClientConfig = {}
console.error('没有开发环境配置文件 -- `.config.dev.js`,正在使用默认配置')
}
} else if(config.isDev === 'test') {
config.url = '//api.ezijing.com'
try {
vueClientConfig = require('../.config.test.js')
} catch (error) {
vueClientConfig = {}
console.error('没有测试环境配置文件 -- `.config.test.js`,正在使用默认配置')
}
} else { } else {
config.url = '//api.ezijing.com' config.url = '//api.ezijing.com'
try {
vueClientConfig = require('../.config.pro.js')
} catch (error) {
vueClientConfig = {}
console.error('没有生产环境配置文件 -- `.config.pro.js`,正在使用默认配置')
}
}
for (let k in vueClientConfig) {
config[k] = vueClientConfig[k]
} }
module.exports = config module.exports = config
let fs = require('fs') const fs = require('fs')
let path = require('path') const path = require('path')
let OSS = require('ali-oss')
const OSS = require('ali-oss')
const conf = require('./config') const conf = require('./config')
let client = new OSS({ const client = new OSS({
region: 'oss-cn-beijing', region: 'oss-cn-beijing',
accessKeyId: 'LTAIOTuuLTaWoGJj', accessKeyId: 'LTAIOTuuLTaWoGJj',
accessKeySecret: 'dE5tTGm2lh35eItct2krW2DeH2lf2I', accessKeySecret: 'dE5tTGm2lh35eItct2krW2DeH2lf2I',
bucket: 'zws-imgs-pub' bucket: 'zws-imgs-pub'
}) })
let DIR_PATH = path.join(__dirname, '../' + conf.DesName) let DIR_PATH = path.join(__dirname, '../' + conf.DesDir)
let PREFIX_PATH = conf.CDN_PATH let PREFIX_PATH = conf.CDN_DIR
let count = 1 let count = 1
......
const path = require('path') const path = require('path')
const webpack = require('webpack') const webpack = require('webpack')
const WebpackMerge = require('webpack-merge')
const conf = require('./config') const _conf = require('./config')
const $GLOBAL = { const $GLOBAL = {
isDev: process.env.NODE_ENV === 'development', isDev: _conf.isDev,
serverPort: process.env.SERVER_PORT || 8000, ResDir: _conf.ResDir,
RootPath: path.resolve(__dirname, '../'),
templatePath: path.resolve(__dirname, ('../' + conf.HtmlPath)), templatePath: path.resolve(__dirname, '../' + _conf.HtmlPath),
icoPath: conf.IcoPath, icoPath: _conf.IcoPath,
EntryPath: path.resolve(__dirname, ('../' + conf.JsPath)),
OutputPath: path.resolve(__dirname, '../' + conf.DesName), EntryPath: path.resolve(__dirname, '../' + _conf.JsPath),
JsName: 'resources/[name].[chunkhash:8].js', OutputPath: path.resolve(__dirname, '../' + _conf.DesDir),
jsName: 'resources/[name].[chunkhash:8].js',
cssName: 'resources/[name].[contenthash:12].css', cssName: 'resources/[name].[contenthash:12].css',
ResPath: 'resources/[name].[hash:8].[ext]', resName: 'resources/[name].[hash:8].[ext]',
EntryStaticPath: path.resolve(__dirname, ('../static')),
OutputStaticPath: path.resolve(__dirname, '../' + conf.DesName + '/static'), EntryStaticPath: path.resolve(__dirname, '../' + 'static'),
BaseConfig: {}, OutputStaticPath: path.resolve(__dirname, '../' + _conf.DesDir + '/static'),
webConf: { webConf: {
'devDomain': conf.url, 'isDev': _conf.isDev,
'apiBaseURL': '/api', 'serverPort': process.env.SERVER_PORT || 8000,
'CDN_PATH': conf.CDN_BASE + conf.CDN_PATH 'domain': _conf.domain,
} 'url': _conf.url,
'isHttps': _conf.isHttps,
'apiBaseURL': _conf.apiBaseURL || '/api',
'CDN_PATH': _conf.CDN_BASE + _conf.CDN_DIR,
'others': _conf.others || {}
},
externals: _conf.webpack.externals || {},
ProvidePlugin: _conf.webpack.ProvidePlugin || {},
BaseConfig: {}
} }
$GLOBAL.BaseConfig = { $GLOBAL.BaseConfig = {
target: 'web', target: 'web',
entry: $GLOBAL.EntryPath, entry: $GLOBAL.EntryPath,
output: { output: {
filename: $GLOBAL.JsName, filename: $GLOBAL.jsName,
path: $GLOBAL.OutputPath, path: $GLOBAL.OutputPath,
publicPath: $GLOBAL.isDev ? '/' : $GLOBAL.webConf.CDN_PATH publicPath: $GLOBAL.isDev === 'development' ? '/' : $GLOBAL.webConf.CDN_PATH
}, },
resolve: { resolve: {
alias: { alias: {
'@services': path.resolve(__dirname, '../client/components/services'), '@': path.resolve(__dirname, '../' + $GLOBAL.ResDir),
'@tools': path.resolve(__dirname, '../client/components/tools'), '@api': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/api'),
'@actions': path.resolve(__dirname, '../client/project/actions') '@action': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/action')
} }
}, },
module: { module: {
...@@ -68,8 +80,9 @@ $GLOBAL.BaseConfig = { ...@@ -68,8 +80,9 @@ $GLOBAL.BaseConfig = {
use: { use: {
loader: 'url-loader', loader: 'url-loader',
options: { options: {
esModule: false,
limit: 4096, limit: 4096,
name: $GLOBAL.ResPath name: $GLOBAL.resName
} }
} }
}, },
...@@ -78,7 +91,7 @@ $GLOBAL.BaseConfig = { ...@@ -78,7 +91,7 @@ $GLOBAL.BaseConfig = {
loader: 'url-loader', loader: 'url-loader',
options: { options: {
limit: 10000, limit: 10000,
name: $GLOBAL.ResPath name: $GLOBAL.resName
} }
}, },
{ {
...@@ -86,28 +99,20 @@ $GLOBAL.BaseConfig = { ...@@ -86,28 +99,20 @@ $GLOBAL.BaseConfig = {
loader: 'url-loader', loader: 'url-loader',
options: { options: {
limit: 10000, limit: 10000,
name: $GLOBAL.ResPath name: $GLOBAL.resName
} }
} }
] ]
}, },
externals: {
},
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'webConf': JSON.stringify($GLOBAL.webConf) 'webConf': JSON.stringify($GLOBAL.webConf)
}), }),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin($GLOBAL.ProvidePlugin)
$: 'jquery', ]
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
],
externals: {
'CKEDITOR': 'window.CKEDITOR',
'VideoJs': 'window.swfobject',
'Base64': 'window.Base64',
'sentNotify': 'window.sentNotify',
'Aliplayer': 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent'
}
} }
$GLOBAL.BaseConfig = WebpackMerge($GLOBAL.BaseConfig, _conf.webpack)
module.exports = $GLOBAL module.exports = $GLOBAL
const fs = require('fs')
const path = require('path')
const webpack = require('webpack') const webpack = require('webpack')
const WebpackMerge = require('webpack-merge') const WebpackMerge = require('webpack-merge')
const CleanWebpackPlugin = require('clean-webpack-plugin') const CleanWebpackPlugin = require('clean-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin') const VueLoaderPlugin = require('vue-loader/lib/plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const AutoPrefixer = require('autoprefixer') const AutoPrefixer = require('autoprefixer')
const MiniCssExtractPlugin = require('mini-css-extract-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const cssnano = require('cssnano')
const HtmlWebpackPlugin = require('html-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin')
const $GLOBAL = require('./webpack.base.conf') const $GLOBAL = require('./webpack.base.conf')
const _conf = require('./config')
let config = null let config = null
if ($GLOBAL.isDev) { if ($GLOBAL.isDev === 'development') {
config = WebpackMerge($GLOBAL.BaseConfig, { config = WebpackMerge($GLOBAL.BaseConfig, {
mode: 'development', mode: 'development',
devtool: '#cheap-module-eval-source-map', devtool: '#cheap-module-eval-source-map',
...@@ -23,10 +23,13 @@ if ($GLOBAL.isDev) { ...@@ -23,10 +23,13 @@ if ($GLOBAL.isDev) {
filename: '[name].js' filename: '[name].js'
}, },
devServer: { devServer: {
port: $GLOBAL.serverPort, port: $GLOBAL.webConf.serverPort,
disableHostCheck: false, disableHostCheck: false,
host: _conf.demain || 'localhost', host: $GLOBAL.webConf.domain || 'localhost',
https: _conf.isHttps, https: $GLOBAL.webConf.isHttps && {
key: fs.readFileSync(path.join(__dirname, '../static/cert/dev.ezijing.com.key')),
cert: fs.readFileSync(path.join(__dirname, '../static/cert/dev.ezijing.com.pem'))
},
overlay: { overlay: {
errors: true errors: true
}, },
...@@ -35,17 +38,17 @@ if ($GLOBAL.isDev) { ...@@ -35,17 +38,17 @@ if ($GLOBAL.isDev) {
}, },
proxy: { proxy: {
'/api': { '/api': {
target: $GLOBAL.webConf.devDomain, target: $GLOBAL.webConf.url,
selfHandleResponse: false, selfHandleResponse: false,
secure: false, secure: false,
changeOrigin: true, changeOrigin: true,
followRedirects: true, followRedirects: true,
logLevel: 'info', logLevel: 'info',
headers: { headers: {
'Referer': $GLOBAL.webConf.devDomain 'Referer': $GLOBAL.webConf.url
}, },
pathRewrite: { pathRewrite: {
'^/api': '/api' '^/api': '/'
} }
} }
}, },
...@@ -92,7 +95,7 @@ if ($GLOBAL.isDev) { ...@@ -92,7 +95,7 @@ if ($GLOBAL.isDev) {
mode: 'production', mode: 'production',
entry: { entry: {
app: $GLOBAL.EntryPath, app: $GLOBAL.EntryPath,
vendor: ['vue'] vendor: ['vue', 'vue-router']
}, },
module: { module: {
rules: [{ rules: [{
...@@ -148,41 +151,7 @@ if ($GLOBAL.isDev) { ...@@ -148,41 +151,7 @@ if ($GLOBAL.isDev) {
} }
} }
]) ])
], ]
optimization: {
runtimeChunk: {
name: 'manifest'
},
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true
}),
new OptimizeCSSAssetsPlugin({
cssProcessor: cssnano,
cssProcessorOptions: { discardComments: { removeAll: true } },
canPrint: true
})
],
splitChunks: {
chunks: 'async',
minSize: 30000,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 3,
name: false,
cacheGroups: {
vendor: {
name: 'vendor',
chunks: 'initial',
priority: -10,
reuseExistingChunk: false,
test: /node_modules\/(.*)\.js/
}
}
}
}
}) })
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论