Sha256: 1c00a5ddf2d38d5e4f6d3b34d02034999d69b9ccba1b755d7b2116a61bd7cd93

Contents?: true

Size: 879 Bytes

Versions: 39

Compression:

Stored size: 879 Bytes

Contents

require "webpacker/configuration"
require "fileutils"

replace_babel_config = FileUtils.compare_file(Rails.root.join("babel.config.js"), "#{__dir__}/config/babel.config.js")

say "Copying babel.config.js to app root directory"
copy_file "#{__dir__}/examples/react/babel.config.js", "babel.config.js", force: replace_babel_config

say "Copying react example entry file to #{Webpacker.config.source_entry_path}"
copy_file "#{__dir__}/examples/react/hello_react.jsx", "#{Webpacker.config.source_entry_path}/hello_react.jsx"

say "Updating webpack paths to include .jsx file extension"
insert_into_file Webpacker.config.config_path, "- .jsx\n".indent(4), after: /\s+extensions:\n/

say "Installing all react dependencies"
run "yarn add react react-dom @babel/preset-react prop-types babel-plugin-transform-react-remove-prop-types"

say "Webpacker now supports react.js 🎉", :green

Version data entries

39 entries across 39 versions & 3 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/react.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/react.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/react.rb
webpacker-5.4.4 lib/install/react.rb
webpacker-5.4.3 lib/install/react.rb
webpacker-5.4.2 lib/install/react.rb
webpacker-5.4.1 lib/install/react.rb
webpacker-5.4.0 lib/install/react.rb
webpacker-5.3.0 lib/install/react.rb
webpacker-5.2.2 lib/install/react.rb
webpacker-5.2.1 lib/install/react.rb
webpacker-4.3.0 lib/install/react.rb
webpacker-5.2.0 lib/install/react.rb
webpacker-5.1.1 lib/install/react.rb
webpacker-5.1.0 lib/install/react.rb
webpacker-5.0.1 lib/install/react.rb
webpacker-5.0.0 lib/install/react.rb
webpacker-4.2.2 lib/install/react.rb
webpacker-4.2.1 lib/install/react.rb
webpacker-4.2.0 lib/install/react.rb