5
4

More than 3 years have passed since last update.

npm pack でnpmパッケージを圧縮する

Posted at

node_module内のファイル(主にandroidのbuild.gradleなど)を編集した際にnpm packのコマンドを使用して変更を加えたパッケージを.tgzファイルにして、package.jsonの読み込み先を.tgzファイルに必要がある。

手順

例:react-native-mapsbuild.gradleを編集した時

  • 編集したパッケージのフォルダに移動(node_modules/react-native-maps/)し、.tgzファイルを生成
npm pack
  • custom_modulesフォルダを作っておき、生成された.tgzファイルをcustom_modulesフォルダに移動する
  • 読込先を.tgzファイルに変更する
npm i react-native-maps-0.24.2.tgz
  • package.jsonの読み込み先が変更されているか確認する
package.json
"react-native-maps": "file:custom_modules/react-native-maps-0.24.2+.tgz"

参考にした記事

5
4
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
5
4