LoginSignup
11
11

More than 5 years have passed since last update.

create-react-app をつかって、2分でReactアプリを開発・Heroku にデプロイする

Last updated at Posted at 2016-12-07

Heroku Advent Calendar 2016 の第8日目の記事です。

10分はかかったぞ! とまあ誰の役にもたたない小ネタ。

image

react (に限らずと思うけど)って、ツールやプラグインが多すぎてわけわからんよね、create-react-app と、↓のビルドパックを使えば、設定なしで react アプリを heroku にすぐ(2分で!)デプロイできるよ、と書いてあったのでやってみた。

image

$npm install -g create-react-app
$create-react-app my-app
$cd my-app
〜この間でちょっと修正して npm run build したりしてる〜
$git init
$heroku create heroku-2016-12-08 -b https://github.com/mars/create-react-app-buildpack.git
$git add .
$git commit -m "とりあえずリリース"
$git push heroku master
$heroku open

で、push した先がこれです。
https://heroku-2016-12-08.herokuapp.com/

image

JS の App は、前述の通り環境周りが辛すぎて、正直わたくし全然追いつけていなかったのですが、確かにこれは楽。これなら続けられる気がします!
実際にガリガリ SPA on Heroku やってるひとの話を聞いてみたい。
お粗末様でした。。。

11
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11