Sha256: 07820eb21c8569c3108144e9abcab04736598d7eacf9d78899f5fc8086a815ab
Contents?: true
Size: 891 Bytes
Versions: 2
Compression:
Stored size: 891 Bytes
Contents
require "webpacker/configuration" babelrc = Jets.root.join(".babelrc") if File.exist?(babelrc) react_babelrc = JSON.parse(File.read(babelrc)) react_babelrc["presets"] ||= [] unless react_babelrc["presets"].include?("react") react_babelrc["presets"].push("react") say "Copying react preset to your .babelrc file" File.open(babelrc, "w") do |f| f.puts JSON.pretty_generate(react_babelrc) end end else say "Copying .babelrc to app root directory" copy_file "#{__dir__}/examples/react/.babelrc", ".babelrc" end 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 "Installing all react dependencies" run "yarn add react react-dom babel-preset-react prop-types" say "Webpacker now supports react.js 🎉", :green
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webpacker-jets-3.2.101 | lib/install/react.rb |
webpacker-jets-3.2.100 | lib/install/react.rb |