0
0

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 3 years have passed since last update.

Kotlin/JSプロジェクトの開発用サーバのポート番号を変更する

Last updated at Posted at 2020-08-02

サーバのポート番号変えられるなら、そちらを変えた方が簡単。
どうしてもクライアント側のポート番号を変えたいとき用。

手順

(1) プロジェクトのルートに、「webpack.config.d」ディレクトリを作成
(2) webpack.config.d配下に、*.jsファイルを作る(たとえばwebpack.config.js)
(3) webpack.config.jsに以下を記述する

config.devServer = Object.assign(config.devServer, {
    port: 8081
});

Object.assignを利用しているのは、port番号以外はデフォルト値にするため。

(4) ./gradlew runを実行する
ポート番号が8081変わっていることが確認できる。

補足

Kotlin/JSではwebpackというJavascriptアプリのビルドツールを使用している。
最終的な、webpackの設定は「build/js/packages//webpack.config.js」に出力される。
このファイルを見ると、Kotlin/JSでのwebpackのデフォルト設定が確認できる。また、「webpack.config.d/*.js」の記述が挿入されていることも確認できる。

参考資料

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?