mirror of
				https://github.com/aleleba/create-react-ssr.git
				synced 2025-10-31 06:00:39 -06:00 
			
		
		
		
	PR-492498: changing some webpack configuration and updating packages.
This commit is contained in:
		| @@ -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}`); | ||||
| }); | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user