i working on a symfony project (was on 2.8) since some month now, and wanted to do one with React.
now i have created a 3.3 project (because asset manifest.json is only handled in 3.3)
succefully installed your ReactBundle and configure to get a working SSR, But while trying production result i got a cannot call function of undefined (only on prod)
to get a prod app.js you have to add this script
"build:client": "encore production"
i tryed this script in a clone of your repo and its apear that you got the same problem on a production test.
i finaly solve the problem by remove this 3 dependency in package.json
"webpack": "^3.2.0",
"webpack-dev-server": "^2.4.5",
"webpack-merge": "^4.1.0"
i'm pretty new with react, but i guess "webpack" isnt necessary since we are using "encore" who seem do the same things ?
and finaly this are the dependency i use actualy where everything work well for my testing.
"dependencies": {
"jquery": "^3.2.1",
"prop-types": "^15.5.10",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-on-rails": "^8.0.3",
"react-redux": "^5.0.5",
"react-router-dom": "^4.1.1",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"@symfony/webpack-encore
": "^0.10.0",
"babel-cli": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"sass-loader": "^6.0.6"
}
Thanks again for this great symfony react Bundle, (before i used plain javascript before app.js to add baseurl by windows.valueIWantShare ...)
but this trick dont work for SSR since javascript from my twig isnt read on a SSR ...
also note that using es2017 instead of es2015 will result in a bug where initialProps and context will be null ... and i dont understand why.