技術っぽいことを書いてみるブログ

PythonとかVue.jsとか技術的なことについて書いていきます。

ReactプロジェクトをViteで作成してみた

背景

Reactを勉強するにあたり、まずはReactプロジェクトを作成する必要があるので、
Viteでプロジェクト作成をした

前提

  • Nodeはインストールされている

やってみた

  1. プロジェクトのコマンド
    npm create vite hello-world -- --template react-ts

    • プロジェクト名は、 hello-world
    • テンプレートに react-tsを指定して、React&TypeScriptとしてみた
  2. 実行した

     PS C:\react-study> npm create vite hello-world -- --template react-ts
    
     Scaffolding project in C:\react-study\hello-world...
    
     Done. Now run:
    
       cd hello-world
       npm install
       npm run dev
    
     PS C:\react-study>
    
    • 実に簡単でした。
  3. 記載されている通り、 cd hello-world/npm install/npm run devする

    • 秒で起動するので、 記載されているURLにブラウザでアクセスすると、初期画面が表示されました。

ご注意

  • npm create viteコマンドの実行は、npmのバージョン等で方言が微妙にあるそうなので、ご注意ください。

最後に…

Reactの勉強がてら、気付きがあれば、記事書いていきます。 ではでは…