These are chat archives for chandu0101/scalajs-react-components

29th
Aug 2017
José Luis Colomer Martorell
@beikern
Aug 29 2017 20:31
Hi, I've been upgrading my react project to the 0.7.0 tag release, It compiles OK but the browser throws the following error:
package.scala:11 Uncaught TypeError: Cannot read property 'Styles' of undefined
    at $c_Lchandu0101_scalajs_react_components_materialui_package$A.MuiThemeProvider__sjs_js_Dynamic (package.scala:11)
    at $c_Lchandu0101_scalajs_react_components_materialui_MuiMuiThemeProvider.apply__sc_Seq__Ljapgolly_scalajs_react_component_Js$UnmountedWithRoot (MuiMuiThemeProvider.scala:23)
    at $c_Lclient_routes_AppRouter$.layout__Ljapgolly_scalajs_react_extra_router_RouterCtl__Ljapgolly_scalajs_react_extra_router_Resolution__Ljapgolly_scalajs_react_vdom_TagOf (AppRouter.scala:64)
    at AppRouter.scala:61
    at $c_sjsr_AnonFunction2.apply__O__O__O (AnonFunctions.scala:20)
    at $c_Ljapgolly_scalajs_react_extra_router_RouterLogic.render__Ljapgolly_scalajs_react_extra_router_Resolution__Ljapgolly_scalajs_react_vdom_VdomElement (Router.scala:144)
    at Router.scala:22
    at $c_sjsr_AnonFunction1.apply__O__O (AnonFunctions.scala:15)
    at Builder.scala:151
    at $c_sjsr_AnonFunction1.apply__O__O (AnonFunctions.scala:15)
$c_Lchandu0101_scalajs_react_components_materialui_package$A.MuiThemeProvider__sjs_js_Dynamic @ package.scala:11
$c_Lchandu0101_scalajs_react_components_materialui_MuiMuiThemeProvider.apply__sc_Seq__Ljapgolly_scalajs_react_component_Js$UnmountedWithRoot @ MuiMuiThemeProvider.scala:23
$c_Lclient_routes_AppRouter$.layout__Ljapgolly_scalajs_react_extra_router_RouterCtl__Ljapgolly_scalajs_react_extra_router_Resolution__Ljapgolly_scalajs_react_vdom_TagOf @ AppRouter.scala:64
(anonymous) @ AppRouter.scala:61
$c_sjsr_AnonFunction2.apply__O__O__O @ AnonFunctions.scala:20
$c_Ljapgolly_scalajs_react_extra_router_RouterLogic.render__Ljapgolly_scalajs_react_extra_router_Resolution__Ljapgolly_scalajs_react_vdom_VdomElement @ Router.scala:144
(anonymous) @ Router.scala:22
$c_sjsr_AnonFunction1.apply__O__O @ AnonFunctions.scala:15
(anonymous) @ Builder.scala:151
$c_sjsr_AnonFunction1.apply__O__O @ AnonFunctions.scala:15
(anonymous) @ ViaReactComponent.scala:256
$c_sjsr_AnonFunction1.apply__O__O @ AnonFunctions.scala:15
(anonymous) @ ViaReactComponent.scala:252
(anonymous) @ ReactCompositeComponent.js:795
measureLifeCyclePerf @ ReactCompositeComponent.js:75
_renderValidatedComponentWithoutOwnerOrContext @ ReactCompositeComponent.js:794
_renderValidatedComponent @ ReactCompositeComponent.js:821
performInitialMount @ ReactCompositeComponent.js:361
mountComponent @ ReactCompositeComponent.js:257
mountComponent @ ReactReconciler.js:45
performInitialMount @ ReactCompositeComponent.js:370
mountComponent @ ReactCompositeComponent.js:257
mountComponent @ ReactReconciler.js:45
mountComponentIntoNode @ ReactMount.js:104
perform @ Transaction.js:143
batchedMountComponentIntoNode @ ReactMount.js:126
perform @ Transaction.js:143
batchedUpdates @ ReactDefaultBatchingStrategy.js:62
batchedUpdates @ ReactUpdates.js:97
_renderNewRootComponent @ ReactMount.js:319
_renderSubtreeIntoContainer @ ReactMount.js:401
render @ ReactMount.js:422
$f_Ljapgolly_scalajs_react_component_Generic$UnmountedSimple__renderIntoDOM__Lorg_scalajs_dom_raw_Element__F0__O @ Generic.scala:70
(anonymous) @ Js.scala:60
$c_sjsr_AnonFunction1.apply__O__O @ AnonFunctions.scala:15
(anonymous) @ Function1.scala:44
$c_sjsr_AnonFunction1.apply__O__O @ AnonFunctions.scala:15
$c_Ljapgolly_scalajs_react_CtorType$ProfunctorN$.dimap__Ljapgolly_scalajs_react_CtorType$Nullary__F1__F1__Ljapgolly_scalajs_react_CtorType$Nullary @ CtorType.scala:194
$c_Ljapgolly_scalajs_react_CtorType$ProfunctorN$.dimap__O__F1__F1__O @ CtorType.scala:191
$c_Ljapgolly_scalajs_react_internal_Profunctor$Ops.dimap__F1__F1__O @ Profunctor.scala:19
$c_Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$$anon$2.init___Ljapgolly_scalajs_react_component_JsBaseComponentTemplate__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__F1__F1__F1__Ljapgolly_scalajs_react_internal_Profunctor @ JsBaseComponentTemplate.scala:62
$c_Ljapgolly_scalajs_react_compone
Any ideas?
José Luis Colomer Martorell
@beikern
Aug 29 2017 21:10

When Play compiles the code and scalajs-bundler bundles the js into a file using fast-opt it throws the following: https://pastebin.com/2cE82xua

Just a ton of messages like these ones:

nfo[] [WARNING in ./client-fastopt.js[
[[info[] [(Emitted value instead of an instance of Error) Cannot find source file '7952af20f883680ac628/client/SPAMain.scala': Error: Can't resolve './7952af20f883680ac628/client/SPAMain.scala' in '/home/beikern/desarrollo/sources/scala-js-spa/client/target/scala-2.12/scalajs-bundler/main'[
[[info[] [ @ ./fastopt-launcher.js 1:0-120[
[[info[] [
[[info[] [WARNING in ./client-fastopt.js[
[[info[] [(Emitted value instead of an instance of Error) Cannot find source file '7952af20f883680ac628/client/appstate/DiodeState.scala': Error: Can't resolve './7952af20f883680ac628/client/appstate/DiodeState.scala' in '/home/beikern/desarrollo/sources/scala-js-spa/client/target/scala-2.12/scalajs-bundler/main'[
[[info[] [ @ ./fastopt-launcher.js 1:0-120[
[[info[] [
[[info[] [WARNING in ./client-fastopt.js[
[[info[] [(Emitted value instead of an instance of Error) Cannot find source file '7952af20f883680ac628/client/components/BootstrapStyles.scala': Error: Can't resolve './7952af20f883680ac628/client/components/BootstrapStyles.scala' in '/home/beikern/desarrollo/sources/scala-js-spa/client/target/scala-2.12/scalajs-bundler/main'[
[[info[] [ @ ./fastopt-launcher.js 1:0-120[
[[info[] [
[[info[] [WARNING in ./client-fastopt.js[
[[info[] [(Emitted value instead of an instance of Error) Cannot find source file '7952af20f883680ac628/client/components/Bootstrap.scala': Error: Can't resolve './7952af20f883680ac628/client/components/Bootstrap.scala' in '/home/beikern/desarrollo/sources/scala-js-spa/client/target/scala-2.12/scalajs-bundler/main'[
[[info[] [ @ ./fastopt-launcher.js 1:0-120[
José Luis Colomer Martorell
@beikern
Aug 29 2017 21:25

I've removed all the MuiMuiThemeProvider references and now it throws this:

MuiFlatButton.scala:100 Uncaught TypeError: Cannot read property 'FlatButton' of undefined
    at $c_Lchandu0101_scalajs_react_components_materialui_MuiFlatButton.apply__sc_Seq__Ljapgolly_scalajs_react_component_Js$UnmountedWithRoot (MuiFlatButton.scala:100)
    at NavToolBar.scala:23
    at $c_sjsr_AnonFunction1.apply__O__O (AnonFunctions.scala:15)
    at Builder.scala:148
    at $c_sjsr_AnonFunction1.apply__O__O (AnonFunctions.scala:15)
    at ViaReactComponent.scala:256
    at $c_sjsr_AnonFunction1.apply__O__O (AnonFunctions.scala:15)
    at Object.<anonymous> (ViaReactComponent.scala:252)
    at ReactCompositeComponent.js:796
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)

It seems like the bundle is not attaching React. Weird. Before using 0.7.0 I was using a local published version from @rleibman fork, scala-js bundler worked fine :(