@@ -8,7 +8,6 @@ import serverRenderReactComponent from './serverRenderReactComponent';
88import buildConsoleReplay from './buildConsoleReplay' ;
99import createReactOutput from './createReactOutput' ;
1010import Authenticity from './Authenticity' ;
11- import context from './context' ;
1211import type {
1312 RegisteredComponent ,
1413 RenderParams ,
@@ -19,31 +18,16 @@ import type {
1918 AuthenticityHeaders ,
2019 Store ,
2120 StoreGenerator ,
21+ ReactOnRails as ReactOnRailsType ,
2222} from './types' ;
2323import reactHydrateOrRender from './reactHydrateOrRender' ;
2424
25- const ctx = context ( ) ;
26-
27- if ( ctx === undefined ) {
28- throw new Error ( "The context (usually Window or NodeJS's Global) is undefined." ) ;
29- }
30-
31- if ( ctx . ReactOnRails !== undefined ) {
32- throw new Error ( `
33- The ReactOnRails value exists in the ${ ctx } scope, it may not be safe to overwrite it.
34-
35- This could be caused by setting Webpack's optimization.runtimeChunk to "true" or "multiple," rather than "single." Check your Webpack configuration.
36-
37- Read more at https://github.com/shakacode/react_on_rails/issues/1558.
38- ` ) ;
39- }
40-
4125const DEFAULT_OPTIONS = {
4226 traceTurbolinks : false ,
4327 turbo : false ,
4428} ;
4529
46- ctx . ReactOnRails = {
30+ const ReactOnRails : ReactOnRailsType = {
4731 options : { } ,
4832 /**
4933 * Main entry point to using the react-on-rails npm package. This is how Rails will be able to
@@ -299,9 +283,4 @@ ctx.ReactOnRails = {
299283 } ,
300284} ;
301285
302- ctx . ReactOnRails . resetOptions ( ) ;
303-
304- ClientStartup . clientStartup ( ctx ) ;
305-
306- export * from "./types" ;
307- export default ctx . ReactOnRails ;
286+ export default ReactOnRails ;
0 commit comments