update script to create server bundle

This commit is contained in:
Cassie Tarakajian 2018-05-03 17:20:40 -07:00
parent 6afa760d36
commit 2d87f09f24
4 changed files with 5079 additions and 4972 deletions

View file

@ -1,14 +1,16 @@
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
process.env.webpackAssets = JSON.stringify(require('./static/dist/manifest.json')); process.env.webpackAssets = JSON.stringify(require('./static/dist/manifest.json'));
process.env.webpackChunkAssets = JSON.stringify(require('./static/dist/chunk-manifest.json')); process.env.webpackChunkAssets = JSON.stringify(require('./static/dist/chunk-manifest.json'));
} require('./static/dist/server.bundle.js');
require('babel-register'); } else {
require('babel-polyfill'); require('babel-register');
let parsed = require('dotenv').config(); require('babel-polyfill');
//// in development, let .env values override those in the environment already (i.e. in docker-compose.yml) let parsed = require('dotenv').config();
if (process.env.NODE_ENV === 'development') { //// in development, let .env values override those in the environment already (i.e. in docker-compose.yml)
if (process.env.NODE_ENV === 'development') {
for (let key in parsed) { for (let key in parsed) {
process.env[key] = parsed[key]; process.env[key] = parsed[key];
} }
}
require('./server/server');
} }
require('./server/server');

10015
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@
"babel-plugin-transform-react-constant-elements": "^6.8.0", "babel-plugin-transform-react-constant-elements": "^6.8.0",
"babel-plugin-transform-react-inline-elements": "^6.8.0", "babel-plugin-transform-react-inline-elements": "^6.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.2.6", "babel-plugin-transform-react-remove-prop-types": "^0.2.6",
"babel-plugin-webpack-loaders": "^0.9.0",
"babel-preset-es2015": "^6.6.0", "babel-preset-es2015": "^6.6.0",
"babel-preset-es2015-native-modules": "^6.9.2", "babel-preset-es2015-native-modules": "^6.9.2",
"babel-preset-react": "^6.5.0", "babel-preset-react": "^6.5.0",
@ -49,8 +50,8 @@
"postcss-reporter": "^1.3.3", "postcss-reporter": "^1.3.3",
"sass-loader": "^6.0.6", "sass-loader": "^6.0.6",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"webpack-externals-plugin": "^1.0.0", "webpack-manifest-plugin": "^1.1.0",
"webpack-manifest-plugin": "^1.1.0" "webpack-node-externals": "^1.7.2"
}, },
"engines": { "engines": {
"node": ">=8.9.0" "node": ">=8.9.0"

View file

@ -1,6 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const ExternalsPlugin = require('webpack-externals-plugin'); const nodeExternals = require('webpack-node-externals');
module.exports = { module.exports = {
@ -17,9 +17,10 @@ module.exports = {
__filename: true, __filename: true,
__dirname: true, __dirname: true,
}, },
externals: [nodeExternals()],
resolve: { resolve: {
extensions: ['', '.js', '.jsx'], extensions: ['*', '.js', '.jsx'],
modules: [ modules: [
'client', 'client',
'node_modules', 'node_modules',
@ -53,10 +54,4 @@ module.exports = {
}, },
], ],
}, },
plugins: [
new ExternalsPlugin({
type: 'commonjs',
include: path.join(__dirname, './node_modules/'),
}),
],
}; };