update script to create server bundle
This commit is contained in:
parent
6afa760d36
commit
2d87f09f24
4 changed files with 5079 additions and 4972 deletions
20
index.js
20
index.js
|
@ -1,14 +1,16 @@
|
|||
if (process.env.NODE_ENV === 'production') {
|
||||
process.env.webpackAssets = JSON.stringify(require('./static/dist/manifest.json'));
|
||||
process.env.webpackChunkAssets = JSON.stringify(require('./static/dist/chunk-manifest.json'));
|
||||
}
|
||||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
let parsed = require('dotenv').config();
|
||||
//// 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) {
|
||||
process.env[key] = parsed[key];
|
||||
require('./static/dist/server.bundle.js');
|
||||
} else {
|
||||
require('babel-register');
|
||||
require('babel-polyfill');
|
||||
let parsed = require('dotenv').config();
|
||||
//// 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) {
|
||||
process.env[key] = parsed[key];
|
||||
}
|
||||
}
|
||||
require('./server/server');
|
||||
}
|
||||
require('./server/server');
|
||||
|
|
10015
package-lock.json
generated
10015
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -25,6 +25,7 @@
|
|||
"babel-plugin-transform-react-constant-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-webpack-loaders": "^0.9.0",
|
||||
"babel-preset-es2015": "^6.6.0",
|
||||
"babel-preset-es2015-native-modules": "^6.9.2",
|
||||
"babel-preset-react": "^6.5.0",
|
||||
|
@ -49,8 +50,8 @@
|
|||
"postcss-reporter": "^1.3.3",
|
||||
"sass-loader": "^6.0.6",
|
||||
"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": {
|
||||
"node": ">=8.9.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const ExternalsPlugin = require('webpack-externals-plugin');
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
@ -17,9 +17,10 @@ module.exports = {
|
|||
__filename: true,
|
||||
__dirname: true,
|
||||
},
|
||||
externals: [nodeExternals()],
|
||||
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx'],
|
||||
extensions: ['*', '.js', '.jsx'],
|
||||
modules: [
|
||||
'client',
|
||||
'node_modules',
|
||||
|
@ -53,10 +54,4 @@ module.exports = {
|
|||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new ExternalsPlugin({
|
||||
type: 'commonjs',
|
||||
include: path.join(__dirname, './node_modules/'),
|
||||
}),
|
||||
],
|
||||
};
|
Loading…
Reference in a new issue