提交 f5384052 authored 作者: 王鹏飞's avatar 王鹏飞

merge

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "dev",
"program": "${workspaceFolder}/server/server/distRun.js",
"env": {
"SERVER_PORT": "4006",
"NODE_ENV": "test"
}
},
{
"type": "node",
"request": "launch",
"name": "production",
"program": "${workspaceFolder}/server/server/distRun.js",
"env": {
"SERVER_PORT": "4006",
"NODE_ENV": "production"
}
}
]
}
...@@ -3,7 +3,8 @@ module.exports = { ...@@ -3,7 +3,8 @@ module.exports = {
url: 'https://wmp-learning2.ezijing.com/api', url: 'https://wmp-learning2.ezijing.com/api',
apiBaseURL: '/', apiBaseURL: '/',
others: { others: {
url: '/login/is-login' url: '/app/learn/course',
loginUrl: 'https://login2.ezijing.com/wmp/login/index'
}, },
webpack: { webpack: {
externals: { externals: {
......
...@@ -3,22 +3,21 @@ module.exports = { ...@@ -3,22 +3,21 @@ module.exports = {
DesDir: '../client-dist', DesDir: '../client-dist',
apiBaseURL: '/', apiBaseURL: '/',
others: { others: {
url: '/login/is-login' url: '/app/learn/course',
loginUrl: 'https://login.ezijing.com/wmp/login/index'
}, },
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'VideoJs': 'window.swfobject', VideoJs: 'window.swfobject',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime', regeneratorRuntime: 'window.regeneratorRuntime',
'$': 'window.$', $: 'window.$',
'Aliplayer': 'window.Aliplayer', Aliplayer: 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent' AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify', // 'sentNotify': 'window.sentNotify',
} }
}, },
ProvidePlugin: { ProvidePlugin: {}
}
} }
...@@ -3,23 +3,22 @@ module.exports = { ...@@ -3,23 +3,22 @@ module.exports = {
DesDir: '../client-dist', DesDir: '../client-dist',
apiBaseURL: '/', apiBaseURL: '/',
others: { others: {
url: '/login/is-login' url: '/app/learn/course',
loginUrl: 'https://login2.ezijing.com/wmp/login/index'
}, },
isUploadStatic: false, isUploadStatic: false,
webpack: { webpack: {
externals: { externals: {
'CKEDITOR': 'window.CKEDITOR', CKEDITOR: 'window.CKEDITOR',
'VideoJs': 'window.swfobject', VideoJs: 'window.swfobject',
'Base64': 'window.Base64', Base64: 'window.Base64',
'md5': 'window.md5', md5: 'window.md5',
'regeneratorRuntime': 'window.regeneratorRuntime', regeneratorRuntime: 'window.regeneratorRuntime',
'$': 'window.$', $: 'window.$',
'Aliplayer': 'window.Aliplayer', Aliplayer: 'window.Aliplayer',
'AliPlayerComponent': 'window.AliPlayerComponent' AliPlayerComponent: 'window.AliPlayerComponent'
// 'sentNotify': 'window.sentNotify', // 'sentNotify': 'window.sentNotify',
} }
}, },
ProvidePlugin: { ProvidePlugin: {}
}
} }
var semver = require('semver')
var requiredVersion = require('../package.json').engines.node
function checkNodeVersion (wanted, id) {
if (!semver.satisfies(process.version, wanted)) {
console.log('\x1b[91m%s\x1B[0m',
'You are using Node ' + process.version + ', but this version of ' + id +
' requires Node ' + wanted + '.\nPlease upgrade your Node version.'
)
process.exit(1)
}
}
checkNodeVersion(requiredVersion, '`node uploadAliyunCDN.js`')
const isDev = process.env.NODE_ENV const isDev = process.env.NODE_ENV
const RegStrs = require('./regExpStr.js')
let config = { let config = {
isDev: isDev, isDev: isDev,
...@@ -12,6 +13,8 @@ let config = { ...@@ -12,6 +13,8 @@ let config = {
isHttps: true, isHttps: true,
isEnableToIphoneDebugger: false,
CDN_BASE: 'https://zws-imgs-pub.ezijing.com/', CDN_BASE: 'https://zws-imgs-pub.ezijing.com/',
CDN_DIR: 'static/build/learn-enterprise/', CDN_DIR: 'static/build/learn-enterprise/',
isUploadStatic: false, isUploadStatic: false,
...@@ -19,10 +22,12 @@ let config = { ...@@ -19,10 +22,12 @@ let config = {
webpack: {} webpack: {}
} }
config.RegStrs = RegStrs
let vueClientConfig = {} let vueClientConfig = {}
config.domain = 'dev.ezijing.com' config.domain = ''
if (config.isDev === 'development') { if (config.isDev === 'development') {
config.url = 'http://dev.ezijing.com:12002' config.url = 'http://' + config.domain + ':12002'
try { try {
vueClientConfig = require('../.config.dev.js') vueClientConfig = require('../.config.dev.js')
} catch (error) { } catch (error) {
......
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAgddAmdjWL+4JUXvmiR/lr9cbdoctEGLwdLpnIrRlL/oVKubZ
TrASed5pA2kHKUbbV9i64iNIzn668ziytivudRiuGL4wBTPdtlpkSty9ij0ZHZXe
23oWQ73fV3FNROp3ekLmIYHqo2ep5hhfq1A4Sey7IM1Z0A9OF6MV7Tgqm+8a6Fy4
eNbgx99f0n7nquGjYZ3RcnU0j6xzfQhOqOYmhk4flQqSx6Mb6sSmWM7V4/h/554L
QyJNV3ngNfT3ZFmAmhIZt7n+o3svzIqwghiZSj0K9jyE7zbSZjVUBEQztFUcfYgP
ZQfZFFsdgIkFSvR3cXIpIiN8oPf8xK6naApOXwIDAQABAoIBAHKlKKJvZvgdO1ca
ir1rT7jKu7IVu4GritvWtzhahrotHEGsYhZru3SmIJ1lQHB+4zAW6zS/qQrDtbkK
yCm4cq4sI5UvYWFGoa7g84tyi12jgyiva37ptv0Li0g/f9WpHePzbBYMC61K3CaS
QO8YPwtvHu/gwjvHN9IBK1wxatYRriAfR6CF2+pfZXhlq3nprc0z9YypExLg2Swa
ML1uQGLObDHAFKheVFYOgWOncMbG5eXNV9mdfzoUuc+mkENDtynQUTzI2ZM4OZFr
uMjto7y4RLFu463Rg0ijg2MXL4FbygzclaePNL7YBS6wed0Z8cE26FvbG5vM//Qc
qYK+WBECgYEA0FdJ7tPzgBvn4VsvBBdA8gmmFmmD/TJxehrxAwn/x0QkcZa6ngxJ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+TC44xCagCQQOzzNmzEAP2SnCrJ
sNE2DpRVMnL8J6xBRdjmOsC3N6cQuKuRXbzByVBjCqAA8t1L0I+9wXJerLPyErjy
rMKWaBFLmfK/AHNF4ZihwPGOc7w6UHczBZXH5RFzJNnww+WnKuTPI0HfnVH8lg==
-----END CERTIFICATE-----
const fs = require('fs')
const path = require('path')
const request = require('request')
const _conf = require('./config')
fs.writeFileSync(path.join(__dirname, _conf.domain + '.key'), '', { encoding: 'utf8', mode: 0o755 })
fs.writeFileSync(path.join(__dirname, _conf.domain + '.pem'), '', { encoding: 'utf8', mode: 0o755 })
request('https://ssl.godzyx.com/' + _conf.domain + '/' + _conf.domain + '.key?get=allow').pipe(fs.createWriteStream(path.join(__dirname, _conf.domain + '.key')))
request('https://ssl.godzyx.com/' + _conf.domain + '/' + _conf.domain + '.pem?get=allow').pipe(fs.createWriteStream(path.join(__dirname, _conf.domain + '.pem')))
/* 由于正则表达式,不能进行跟 gulpfile 中 去注释 在一起 */
module.exports = {
regExp_static: /('|"|`)[\.|\/]*?static\/(.*?\.(png|jpe?g|gif|svg|ico)(\?.*)?)\1/g
}
const _conf = require('./config')
module.exports = function (source) {
if (_conf.isDev !== 'development') {
return source
.replace(_conf.RegStrs.regExp_static, '$1' + _conf.CDN_BASE + _conf.CDN_DIR + 'static/$2$1')
} else {
return source
}
}
...@@ -25,6 +25,7 @@ let fileCount = 1 ...@@ -25,6 +25,7 @@ let fileCount = 1
async function uploadFile (prefixPath, dirFileName) { async function uploadFile (prefixPath, dirFileName) {
const upFilePath = prefixPath.replace(new RegExp(DIR_PATH, 'gi'), '') + path.basename(dirFileName) const upFilePath = prefixPath.replace(new RegExp(DIR_PATH, 'gi'), '') + path.basename(dirFileName)
try { try {
const upFilePath = prefixPath.replace(new RegExp(DIR_PATH, 'gi'), '') + path.basename(dirFileName)
const result = await client.put(prefixPath + path.basename(dirFileName), dirFileName, { const result = await client.put(prefixPath + path.basename(dirFileName), dirFileName, {
headers, headers,
timeout: 600000 timeout: 600000
......
...@@ -7,6 +7,7 @@ const _conf = require('./config') ...@@ -7,6 +7,7 @@ const _conf = require('./config')
const $GLOBAL = { const $GLOBAL = {
isDev: _conf.isDev, isDev: _conf.isDev,
ResDir: _conf.ResDir, ResDir: _conf.ResDir,
'isEnableToIphoneDebugger': _conf.isEnableToIphoneDebugger,
templatePath: path.resolve(__dirname, '../' + _conf.HtmlPath), templatePath: path.resolve(__dirname, '../' + _conf.HtmlPath),
icoPath: _conf.IcoPath, icoPath: _conf.IcoPath,
...@@ -21,9 +22,12 @@ const $GLOBAL = { ...@@ -21,9 +22,12 @@ const $GLOBAL = {
EntryStaticPath: path.resolve(__dirname, '../' + 'static'), EntryStaticPath: path.resolve(__dirname, '../' + 'static'),
OutputStaticPath: path.resolve(__dirname, '../' + _conf.DesDir + '/static'), OutputStaticPath: path.resolve(__dirname, '../' + _conf.DesDir + '/static'),
RegStrs: _conf.RegStrs,
webConf: { webConf: {
'isDev': _conf.isDev, 'isDev': _conf.isDev,
'serverPort': process.env.SERVER_PORT || 8000, 'serverPort': process.env.SERVER_PORT || 8000,
'isEnableToIphoneDebugger': _conf.isEnableToIphoneDebugger,
'domain': _conf.domain, 'domain': _conf.domain,
'url': _conf.url, 'url': _conf.url,
'isHttps': _conf.isHttps, 'isHttps': _conf.isHttps,
...@@ -50,7 +54,8 @@ $GLOBAL.BaseConfig = { ...@@ -50,7 +54,8 @@ $GLOBAL.BaseConfig = {
'@api': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/api'), '@api': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/api'),
'@action': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/action'), '@action': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/action'),
'@tool': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/tool') '@tool': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/tool')
} },
extensions: ['.js', '.json', '.jsx', '.vue']
}, },
module: { module: {
rules: [ rules: [
...@@ -60,6 +65,12 @@ $GLOBAL.BaseConfig = { ...@@ -60,6 +65,12 @@ $GLOBAL.BaseConfig = {
exclude: /node_modules/, exclude: /node_modules/,
enforce: 'pre' enforce: 'pre'
}, },
{
test: /\.(vue|js|jsx)|((sa|sc|c)ss)$/,
loader: './build/stringReplaceLoader.js',
exclude: /node_modules/,
enforce: 'pre'
},
{ {
test: /\.vue$/, test: /\.vue$/,
loader: 'vue-loader' loader: 'vue-loader'
...@@ -69,10 +80,32 @@ $GLOBAL.BaseConfig = { ...@@ -69,10 +80,32 @@ $GLOBAL.BaseConfig = {
exclude: /(node_modules)|(dist)/, exclude: /(node_modules)|(dist)/,
loader: 'babel-loader', loader: 'babel-loader',
options: { options: {
presets: ['env', 'stage-2'], presets: [[
'@babel/preset-env',
{
"targets": {
"browsers": [
"last 2 versions",
"ie >= 11"
],
},
corejs: '3.6.5',
useBuiltIns: 'usage'
}
]],
plugins: [ plugins: [
'transform-vue-jsx', '@babel/plugin-syntax-jsx',
'syntax-dynamic-import' '@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
[
'@babel/plugin-transform-runtime',
{
corejs: 3,
helpers: true,
regenerator: true,
useESModules: false
}
]
] ]
} }
}, },
......
...@@ -9,7 +9,9 @@ const VueLoaderPlugin = require('vue-loader/lib/plugin') ...@@ -9,7 +9,9 @@ const VueLoaderPlugin = require('vue-loader/lib/plugin')
const AutoPrefixer = require('autoprefixer') const AutoPrefixer = require('autoprefixer')
const MiniCssExtractPlugin = require('mini-css-extract-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin')
const VconsoleWebpackPlugin = require('vconsole-webpack-plugin')
const $GLOBAL = require('./webpack.base.conf') const $GLOBAL = require('./webpack.base.conf')
...@@ -26,9 +28,10 @@ if ($GLOBAL.isDev === 'development') { ...@@ -26,9 +28,10 @@ if ($GLOBAL.isDev === 'development') {
port: $GLOBAL.webConf.serverPort, port: $GLOBAL.webConf.serverPort,
disableHostCheck: false, disableHostCheck: false,
host: $GLOBAL.webConf.domain || 'localhost', host: $GLOBAL.webConf.domain || 'localhost',
http2: false,
https: $GLOBAL.webConf.isHttps && { https: $GLOBAL.webConf.isHttps && {
key: fs.readFileSync(path.join(__dirname, '../static/cert/dev.ezijing.com.key')), key: fs.readFileSync(path.join(__dirname, $GLOBAL.webConf.domain + '.key')),
cert: fs.readFileSync(path.join(__dirname, '../static/cert/dev.ezijing.com.pem')) cert: fs.readFileSync(path.join(__dirname, $GLOBAL.webConf.domain + '.pem'))
}, },
overlay: { overlay: {
errors: true errors: true
...@@ -77,7 +80,7 @@ if ($GLOBAL.isDev === 'development') { ...@@ -77,7 +80,7 @@ if ($GLOBAL.isDev === 'development') {
} }
}, },
{ {
loader: 'sass-loader', // 不再使用本身默认 node-sass,部分mac安装有问题。 loader: 'sass-loader',
options: { options: {
implementation: require('dart-sass') implementation: require('dart-sass')
} }
...@@ -92,6 +95,10 @@ if ($GLOBAL.isDev === 'development') { ...@@ -92,6 +95,10 @@ if ($GLOBAL.isDev === 'development') {
template: $GLOBAL.templatePath, template: $GLOBAL.templatePath,
inject: true, inject: true,
favicon: $GLOBAL.icoPath favicon: $GLOBAL.icoPath
}),
new VconsoleWebpackPlugin({
filter: [],
enable: $GLOBAL.isEnableToIphoneDebugger
}) })
] ]
}) })
...@@ -100,7 +107,7 @@ if ($GLOBAL.isDev === 'development') { ...@@ -100,7 +107,7 @@ if ($GLOBAL.isDev === 'development') {
mode: 'production', mode: 'production',
entry: { entry: {
app: $GLOBAL.EntryPath, app: $GLOBAL.EntryPath,
vendor: ['vue', 'vue-router'] vendor: ['vue', 'vue-router', 'vue-i18n']
}, },
module: { module: {
rules: [{ rules: [{
...@@ -128,7 +135,7 @@ if ($GLOBAL.isDev === 'development') { ...@@ -128,7 +135,7 @@ if ($GLOBAL.isDev === 'development') {
} }
}, },
{ {
loader: 'sass-loader', // 不再使用本身默认 node-sass,部分mac安装有问题。 loader: 'sass-loader',
options: { options: {
implementation: require('dart-sass') implementation: require('dart-sass')
} }
...@@ -152,6 +159,12 @@ if ($GLOBAL.isDev === 'development') { ...@@ -152,6 +159,12 @@ if ($GLOBAL.isDev === 'development') {
collapseWhitespace: true collapseWhitespace: true
} }
}), }),
new HtmlReplaceWebpackPlugin([
{
pattern: $GLOBAL.RegStrs.regExp_static,
replacement: '$1' + $GLOBAL.webConf.CDN_PATH + 'static/$2$1'
}
]),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ {
from: $GLOBAL.EntryStaticPath, from: $GLOBAL.EntryStaticPath,
...@@ -161,7 +174,11 @@ if ($GLOBAL.isDev === 'development') { ...@@ -161,7 +174,11 @@ if ($GLOBAL.isDev === 'development') {
return content return content
} }
} }
]) ]),
new VconsoleWebpackPlugin({
filter: [],
enable: $GLOBAL.isEnableToIphoneDebugger
})
], ],
optimization: { optimization: {
runtimeChunk: { runtimeChunk: {
...@@ -170,27 +187,19 @@ if ($GLOBAL.isDev === 'development') { ...@@ -170,27 +187,19 @@ if ($GLOBAL.isDev === 'development') {
splitChunks: { splitChunks: {
chunks: 'async', chunks: 'async',
minSize: 30000, minSize: 30000,
maxSize: 400000, // 大于400kb 会再进行拆分,可以进行优化时,添加 maxSize: 400000,
minChunks: 1, minChunks: 1,
maxAsyncRequests: 5, // 按需加载块时并行请求的最大数量 maxAsyncRequests: 5,
maxInitialRequests: 3, // 初始页面加载时并行请求的最大数量 maxInitialRequests: 3,
name: false, name: false,
cacheGroups: { cacheGroups: {
vendor: { // 将所有node_modules中模块 js打包到一起,并拆分 vendor: {
name: 'vendor', name: 'vendor',
chunks: 'initial', chunks: 'initial',
priority: -10, priority: -10,
reuseExistingChunk: false, reuseExistingChunk: false,
test: /node_modules\/(.*)\.js/ test: /node_modules\/(.*)\.js/
}, },
// styles: { // 将所有node_modules中模块 css、scss打包到一起,并拆分,暂时没用,还在研究
// name: 'styles',
// test: /node_modules\/\.(sa|sc|c)ss$/,
// chunks: 'all',
// minChunks: 1,
// reuseExistingChunk: true,
// enforce: true
// }
} }
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论