mirror of
https://github.com/desktop/desktop
synced 2024-09-19 08:02:22 +00:00
Allow starting in prod env
This commit is contained in:
parent
8db3c11c2d
commit
06cfe88c39
|
@ -12,6 +12,7 @@
|
|||
"test:review": "node script/test-review",
|
||||
"postinstall": "cd app && npm install && cd .. && git submodule update --recursive --init && npm run compile:tslint",
|
||||
"start": "cross-env NODE_ENV=development node script/start",
|
||||
"start:prod": "cross-env NODE_ENV=production node script/start",
|
||||
"debug": "cross-env NODE_ENV=development node script/debug",
|
||||
"compile:dev": "cross-env NODE_ENV=development webpack --config app/webpack.development.js",
|
||||
"compile:prod": "cross-env NODE_ENV=production webpack --config app/webpack.production.js",
|
||||
|
|
16
script/start
16
script/start
|
@ -2,17 +2,29 @@
|
|||
|
||||
'use strict'
|
||||
|
||||
const run = require('./run')
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
const runningApp = run()
|
||||
|
||||
if (!runningApp) {
|
||||
console.error("Couldn't launch the app. You probably need to build it first. Run `npm run build:dev`.")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
const express = require('express')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../app/webpack.development')
|
||||
const run = require('./run')
|
||||
|
||||
const server = express()
|
||||
const compiler = webpack(config)
|
||||
const port = process.env.PORT || 3000
|
||||
|
||||
server.use(require('webpack-dev-middleware')(compiler, {
|
||||
publicPath: config.output.publicPath,
|
||||
publicPath: config[2].output.publicPath,
|
||||
noInfo: true
|
||||
}))
|
||||
|
||||
|
|
Loading…
Reference in a new issue