0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Reactプロジェクト環境ごとプロパティ設定方法

Posted at
①Env-cmdモジュールをダウンロードする
②「packae.json」に下記のように設定する
※必要に応じて、環境用の「.env」を作ること
    ...省略...
    "scripts": {
        //開発環境用プロパティ
        "dev:dev": "env-cmd -f .env.dev next dev",
        //商用環境用プロパティ
        "dev:shouyou": "env-cmd -f .env.shouyou next dev",
        "build:dev": "env-cmd -f .env.dev next dev",
        "build:shouyou": "env-cmd -f .env.shouyou next dev",
        "start": "next start",
        "lint": "next lint"
    },
    ...省略...
③実行の際、「npm run dev:dev」の場合、「.env.dev」に定義したプロパティを参照する
④ビルドの際(.next生成)、「npm run build:shouyou」の場合、「.env.shouyou」を参照し、.nextを生成する

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?