Skip to content

Commit 2928c35

Browse files
committed
uu
1 parent 77cbe54 commit 2928c35

File tree

9 files changed

+17
-13
lines changed

9 files changed

+17
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "npm run clear && cross-env NODE_ENV=development webpack-dev-server --config webpack.config.dev.babel.js --watch --progress",
1010
"build": "npm run clear && cross-env NODE_ENV=production webpack --config webpack.config.prod.babel.js --progress",
1111
"build:server": "npm run clear:server && cross-env NODE_ENV=production webpack --config webpack.config.server.babel.js --colors --progress",
12-
"build:ssr": "npm run build && npm run build:server && pm2 start processes.json"
12+
"build:ssr": "npm run build && npm run build:server && pm2 start pm2Config.json"
1313
},
1414
"author": "shawn",
1515
"license": "MIT",

processes.json renamed to pm2Config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"error_file": "./log/node-app/node-app.stderr.log",
99
"out_file": "./log/node-app.stdout.log",
1010
"pid_file": "pids/node-geo-api.pid",
11-
"instances": 0,
11+
"instances": 6,
1212
"min_uptime": "200s",
1313
"max_restarts": 10,
1414
"max_memory_restart": "1M",

server/SSR/src/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ global.location = window.location
1717
global.history = window.history
1818
global.sessionStorage = window.sessionStorage
1919
const DOCS_PATH = '../../../dist';
20-
const PORT = 8090;
20+
const PORT = 8070;
2121
const IP_ADRESS = 'localhost';
2222
const app = express();
2323
let templateHtml = fs.readFileSync(path.join(__dirname, `${DOCS_PATH}/assets/index.html`), 'utf8')

src/config/prod.env.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default {
2-
domain: "'http://test-api.rswallet.com:7046'"
2+
domain: "'https://www.easy-mock.com/mock/59ccc101a0ab222a113ab3d9'"
33
}

src/config/test.env.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default {
2-
domain: "'http://test-api.rswallet.com:7046'"
2+
domain: "'https://www.easy-mock.com/mock/59ccc101a0ab222a113ab3d9'"
33
}

src/reduxes/store/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import middleware from 'reduxes/middleware'
55
import reducers, { injectStore } from 'reduxes/reducers'
66

77

8-
const finalCreateStore = compose(applyMiddleware(thunk, middleware), window.devToolsExtension ? window.devToolsExtension() : f => f, )(createStore)
8+
const finalCreateStore = compose(applyMiddleware(thunk, middleware), )(createStore)
99
let store
1010
// window.devToolsExtension ? window.devToolsExtension() : f => f,
1111
store = finalCreateStore(reducers)

webpack.config.dev.babel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ module.exports = {
7171
new webpack.HotModuleReplacementPlugin(),
7272
new webpack.NamedModulesPlugin(),
7373
new webpack.DefinePlugin({
74+
NODE_ENV: process.env.NODE_ENV,
7475
__ENV__: process.env.NODE_ENV == 'production' ? prodApiConfig : process.env.NODE_ENV == 'development' ? devApiConfig : process.env.NODE_ENV == 'test' ? testApiConfig : devApiConfig
7576
}),
7677
extractSass

webpack.config.prod.babel.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ module.exports = {
7575
new HtmlWebpackPlugin({
7676
template: path.join(__dirname, './src/index.html')
7777
}),
78-
new webpack.DefinePlugin({
79-
__ENV__: process.env.NODE_ENV == 'production' ? prodApiConfig : process.env.NODE_ENV == 'development' ? devApiConfig : process.env.NODE_ENV == 'test' ? testApiConfig : devApiConfig
80-
}),
8178
// 压缩JS代码,CSS 没有被压缩到
8279
new webpack.optimize.UglifyJsPlugin({
8380
output: {
@@ -91,10 +88,9 @@ module.exports = {
9188
}),
9289
new webpack.IgnorePlugin(/vertx/),
9390
new webpack.DefinePlugin({
94-
'process.env': {
95-
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
96-
}
97-
})
91+
NODE_ENV: process.env.NODE_ENV,
92+
__ENV__: process.env.NODE_ENV == 'production' ? prodApiConfig : process.env.NODE_ENV == 'development' ? devApiConfig : process.env.NODE_ENV == 'test' ? testApiConfig : devApiConfig
93+
}),
9894
],
9995
resolve: {
10096
extensions: ['.js', '.md', '.txt'],

webpack.config.server.babel.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import path from 'path'
22
import ExtractTextPlugin from 'extract-text-webpack-plugin'
33
import webpack from 'webpack';
44
import CompressionPlugin from 'compression-webpack-plugin'
5+
import devApiConfig from './src/config/dev.env'
6+
import testApiConfig from './src/config/test.env'
7+
import prodApiConfig from './src/config/prod.env'
58
var ignore = new webpack.IgnorePlugin(new RegExp("/(node_modules|ckeditor)/"))
69
const extractSass = new ExtractTextPlugin({
710
filename: "../assets/styles.[hash].css",
@@ -29,6 +32,10 @@ module.exports = {
2932
threshold: 10240,
3033
minRatio: 0.8
3134
}),
35+
new webpack.DefinePlugin({
36+
NODE_ENV: process.env.NODE_ENV,
37+
__ENV__: process.env.NODE_ENV == 'production' ? prodApiConfig : process.env.NODE_ENV == 'development' ? devApiConfig : process.env.NODE_ENV == 'test' ? testApiConfig : devApiConfig
38+
}),
3239
],
3340
module: {
3441
rules: [

0 commit comments

Comments
 (0)