Browse Source

(*)移除无用配置

master
peng.peng 2 years ago
parent
commit
056a16234f
  1. 17
      web/config.js
  2. 15
      web/webpack.config.prod.js

17
web/config.js

@ -27,12 +27,6 @@ const ANXINCLOUD_QINIU_SECRETKEY = process.env.ANXINCLOUD_QINIU_SECRETKEY || fla
const ANXINCLOUD_QINIU_BUCKET_RESOURCE = process.env.ANXINCLOUD_QINIU_BUCKET_RESOURCE || flags.qnbkt; const ANXINCLOUD_QINIU_BUCKET_RESOURCE = process.env.ANXINCLOUD_QINIU_BUCKET_RESOURCE || flags.qnbkt;
const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn; const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn;
//阿里OSS
const ALI_OSS_ACCESSKEY = process.env.ALI_OSS_ACCESSKEY || flags.aliOssAccessKey;
const ALI_OSS_SECRETKET = process.env.ALI_OSS_SECRETKET || flags.aliOssSecretKey;
const ALI_OSS_BUCKET = process.env.ALI_OSS_BUCKET || flags.aliOssBucket;
const ALI_OSS_REGION = process.env.ALI_OSS_REGION || flags.aliOssRegion;
if ( if (
!FS_UNIAPP_API !FS_UNIAPP_API
// || !ANXINCLOUD_QINIU_ACCESSKEY // || !ANXINCLOUD_QINIU_ACCESSKEY
@ -48,10 +42,6 @@ if (
const product = { const product = {
port: flags.port || 8080, port: flags.port || 8080,
staticDirs: [path.join(__dirname, './client')], staticDirs: [path.join(__dirname, './client')],
frontParams: {
// 以大写字母命名
FS_API_ROOT: FS_UNIAPP_API
},
mws: [ mws: [
{ {
entry: require('./middlewares/proxy').entry, entry: require('./middlewares/proxy').entry,
@ -81,13 +71,6 @@ const product = {
qiniu: { qiniu: {
fetchUrl: '/_file-server', fetchUrl: '/_file-server',
domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE
},
aliOss: {
fetchUrl: '/_file-ali-server',
accessKey: ALI_OSS_ACCESSKEY,
secretKey: ALI_OSS_SECRETKET,
bucket: ALI_OSS_BUCKET,
region: ALI_OSS_REGION
} }
} }
}, },

15
web/webpack.config.prod.js

@ -1,13 +1,12 @@
var path = require('path'); var path = require('path');
var webpack = require('webpack'); var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin');
const config = require('./config.js');
const PATHS = { const PATHS = {
app: path.join(__dirname, 'client/src'), app: path.join(__dirname, 'client/src'),
build: path.join(__dirname, 'client/build') build: path.join(__dirname, 'client/build')
}; };
console.log(config);
module.exports = { module.exports = {
mode: "production", mode: "production",
entry: { entry: {
@ -31,17 +30,7 @@ module.exports = {
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: '../index.html', filename: '../index.html',
template: './client/index.ejs' template: './client/index.ejs'
}), })
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
...(() => {
let nextParams = {}
for (let k in config.frontParams) {
nextParams[k] = JSON.stringify(config.frontParams[k])
}
return nextParams
})()
}),
], ],
optimization: { optimization: {
splitChunks: { splitChunks: {

Loading…
Cancel
Save