Commit 56252642 authored by Matija Obreza's avatar Matija Obreza
Browse files

Express: setup

fixed ssr express startup
parent 7ad152fd
......@@ -15,7 +15,7 @@ module.exports = {
target: 'node',
mode: ifThenElse(IS_PRODUCTION, 'production', 'development'),
entry: {
server: ['./src/index.ts']
server: ['./server/index.ts']
},
output: {
......
......@@ -46,7 +46,7 @@ module.exports = {
devServer: {
hot: true,
inline: true,
contentBase: path.join(__dirname, '../../../'),
contentBase: path.join(__dirname, '../'),
compress: true,
port: PORT,
host: HOST,
......@@ -115,7 +115,7 @@ module.exports = {
},
entry: {
genesys: [ 'babel-polyfill', './entrypoints/client.tsx' ],
gringlobal: [ 'babel-polyfill', './entrypoints/client.tsx' ],
},
output: {
......@@ -172,14 +172,14 @@ module.exports = {
// Inject scripts to app's real index.html
new HtmlWebpackPlugin({
title: 'Genesys', // The title to use for the generated HTML document
title: 'GRIN-Global Client', // The title to use for the generated HTML document
filename: 'index.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
excludeAssets: [/server(\..+)*\.js/],
template: './entrypoints/index.html',
// chunksSortMode: sortedChunks(['vendor', 'common', 'genesys']),
// chunks: ['vendor', 'common', 'genesys'],
// chunksSortMode: sortedChunks(['vendor', 'common', 'gringlobal']),
// chunks: ['vendor', 'common', 'gringlobal'],
favicon: 'favicon.ico',
version: gitRevisionPlugin.version(),
commithash: gitRevisionPlugin.commithash(),
......@@ -188,14 +188,14 @@ module.exports = {
// Inject scripts for SSR
new HtmlWebpackPlugin({
title: 'Genesys', // The title to use for the generated HTML document
title: 'GRIN-Global Client', // The title to use for the generated HTML document
filename: 'ssr-compiled.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
excludeAssets: [/server(\..+)*\.js/],
template: './assets/html/ssr-template.html',
// chunksSortMode: sortedChunks(['vendor', 'common', 'genesys']),
// chunks: ['vendor', 'common', 'genesys'],
// chunksSortMode: sortedChunks(['vendor', 'common', 'gringlobal']),
// chunks: ['vendor', 'common', 'gringlobal'],
favicon: 'favicon.ico',
version: gitRevisionPlugin.version(),
commithash: gitRevisionPlugin.commithash(),
......@@ -203,7 +203,7 @@ module.exports = {
}),
new HtmlWebpackPlugin({
title: 'Genesys', // The title to use for the generated HTML document
title: 'GRIN-Global Client', // The title to use for the generated HTML document
filename: 'ssr-error.html', // The file to write the HTML to
xhtml: true,
excludeAssets: [/server(\..+)*\.ts/],
......@@ -215,7 +215,7 @@ module.exports = {
// Defer/Async scripts
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'async',
// async: [ 'genesys' ],
// async: [ 'gringlobal' ],
}),
// Keep CSS separate
......
......@@ -50,6 +50,7 @@ const SsrI18nProvider = withSSR()(I18nextProvider) as any;
// Configure axios for client
configureBackendApi({ apiUrl: store.getState().applicationConfig.apiUrl || process.env.API_URL || 'http://localhost:8080' });
console.log('Here we are!', i18nClient);
sagaMiddleware.run(saga);
if (__PRELOADED_STATE__ === undefined) {
......
......@@ -4,11 +4,12 @@
"license": "Apache-2.0",
"description": "",
"scripts": {
"i18nGenerate": "cross-env moduleName=express includedLocales=['../client/locales/**/*.json'] lerna run i18n:generateI18n --stream",
"build": "lerna run precompile && yarn run build:client && yarn run build:server",
"clean": "rimraf generated",
"i18nGenerate": "cross-env moduleName=express includedLocales=['../client/locales/**/*.json'] gg-i18n",
"build": "yarn run i18nGenerate && yarn run build:client && yarn run build:server",
"build:server": "webpack --config config/server.config.js",
"build:client": "cross-env NODE_ENV=development SSR=true webpack --config config/webpack-production.config.js",
"start:dev": "lerna run precompile && cross-env NODE_OPTIONS=--max_old_space_size=8192 webpack-dev-server --config config/webpack-development.config.js",
"start:dev": "yarn run i18nGenerate && cross-env NODE_OPTIONS=--max_old_space_size=8192 webpack-dev-server --config config/webpack-development.config.js",
"start:prod": "yarn run build && cd ../../target/app/server && node server.js"
},
"dependencies": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment