PR-492498: changing some webpack configuration and updating packages.

This commit is contained in:
2022-08-30 17:00:36 +00:00
parent 1086989101
commit 9c2c283f61
11 changed files with 1336 additions and 1301 deletions

View File

@ -2,7 +2,7 @@
import express from 'express';
import webpack from 'webpack';
import helmet from 'helmet';
import config from '../../config';
import { config } from '../../config';
//Dependencies of HotReloading
import webpackConfig from '../../webpack.config.dev';
@ -24,7 +24,7 @@ import { getHashManifest, haveVendorsCss } from './utilsServer';
//App
import App from '../frontend/components/App';
const { env, port } = config;
const { ENV, PORT } = config;
const routesUrls = routes.map( route => route.path);
@ -32,7 +32,7 @@ const app = express();
// @ts-ignore:next-line
const compiler = webpack(webpackConfig);
if(env === 'development'){
if(ENV === 'development'){
const serverConfig = {
serverSideRender: true,
publicPath: webpackConfig.output?.publicPath,
@ -122,6 +122,6 @@ app
.get('*', renderApp);
app.listen(port, () => {
console.log(`Server running on port ${port}`);
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});

View File

@ -1,7 +1,7 @@
import fs from 'fs';
import config from '../../config';
import { config } from '../../config';
const { env } = config
const { ENV } = config;
export const getHashManifest = () => {
try {
@ -18,8 +18,8 @@ export const haveVendorsCss = (manifest, memoryFs) => {
try {
const baseUrl = __dirname.replace(/\/server(.*)/,'');
const fullURL = `${baseUrl}${manifest ? manifest['vendors.css'] : '/build/assets/vendors.css'}`;
env === 'production' && fs.readFileSync(fullURL).toString();
env === 'development' && memoryFs.readFileSync(fullURL).toString();
ENV === 'production' && fs.readFileSync(fullURL).toString();
ENV === 'development' && memoryFs.readFileSync(fullURL).toString();
return true
}catch(err){
// console.error(err);