Skip to content

Commit

Permalink
bundle exec rails generate react:install
Browse files Browse the repository at this point in the history
  • Loading branch information
kinoppyd committed Nov 30, 2020
1 parent fe7da2c commit a7d295d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/src/packs/application.js
Expand Up @@ -13,3 +13,7 @@ require("@rails/activestorage").start()
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)
// Support component names relative to this directory:
var componentRequireContext = require.context("components", true);
var ReactRailsUJS = require("react_ujs");
ReactRailsUJS.useContext(componentRequireContext);
5 changes: 5 additions & 0 deletions client/src/packs/server_rendering.js
@@ -0,0 +1,5 @@
// By default, this pack is loaded for server-side rendering.
// It must expose react_ujs as `ReactRailsUJS` and prepare a require context.
var componentRequireContext = require.context("components", true);
var ReactRailsUJS = require("react_ujs");
ReactRailsUJS.useContext(componentRequireContext);
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -12,6 +12,7 @@
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react_ujs": "^2.6.1",
"ts-loader": "^8.0.11",
"typescript": "^4.1.2"
},
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Expand Up @@ -6252,6 +6252,13 @@ react@^17.0.1:
loose-envify "^1.1.0"
object-assign "^4.1.1"

react_ujs@^2.6.0, react_ujs@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/react_ujs/-/react_ujs-2.6.1.tgz#a202a33c95c9e2bb18ab56926b7e79f3325ec855"
integrity sha512-9M33/A8cubStkZ2cpJSimcTD0RlCWiqXF6e90IQmMw/Caf/W0dtAzOtHtiQE3JjLbt/nhRR7NLPxMfnlm141ig==
dependencies:
react_ujs "^2.6.0"

read-cache@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774"
Expand Down

0 comments on commit a7d295d

Please sign in to comment.