Skip to content

Commit

Permalink
allow running ./server.js also for prod/
Browse files Browse the repository at this point in the history
  • Loading branch information
bdittes committed Oct 10, 2019
1 parent f2adeb5 commit 68df716
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"check-types": "tsc --noEmit --pretty",
"watch-types": "tsc --noEmit --pretty --watch --preserveWatchOutput",
"production-build": "export NODE_ENV=production; rm -rf prod/* && webpack --config ./webpack.production.config.js --progress --profile --colors && babel -D -d prod/app --extensions .js,.ts app && cp *.js prod/",
"run-production": "export NODE_ENV=production; cd prod && node server.js",
"run-production": "export NODE_ENV=production; node server.js",
"dev-server": "./node_modules/.bin/nodemon ./server.js --ignore 'app/dist/*' --watch 'app/api' --watch 'app/shared' --exec babel-node --extensions .js,.ts",
"webpack-server": "babel-node --extensions .js,.ts ./webpack/webpack.server.js",
"hot": "export HOT=true;npm run watch-types & npm run dev-server & npm run webpack-server",
Expand Down
9 changes: 8 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
require('@babel/register')();

const { NODE_ENV } = process.env;


require.extensions['.scss'] = function scss() {};
require.extensions['.css'] = function css() {};

require('./app/server.js');
if (NODE_ENV == 'production') {
require('./prod/app/server.js');
} else {
require('./app/server.js');
}

0 comments on commit 68df716

Please sign in to comment.