Skip to content

.npmrc คือ NPM Configuration File ซึ่งสามารถใช้เป็น PNPM Configuration File ได้

sh
# ยกระดับแพ็คเกจที่มีคำว่า "types" ในชื่อ
hoist-pattern[]=*types*

# ไม่ยกระดับแพ็คเกจ @types/react
hoist-pattern[]=!@types/react

# กำหนด registry ที่จะใช้
registry=https://registry.npmjs.org/

# บังคับให้ใช้ pnpm แทน npm หรือ yarn
engine-strict=true

# กำหนดตำแหน่งของ store
store-dir=~/.pnpm-store

# เปิดใช้งาน workspaces
use-workspace-root=true

# กำหนดเวอร์ชันของ Node.js ที่ต้องการ
node-version=14.0.0

# ตั้งค่าให้ติดตั้งแพ็คเกจแบบ production เท่านั้น
production=true

# กำหนด scope สำหรับแพ็คเกจส่วนตัว
@myscope:registry=https://private-registry.com/

# ตั้งค่า proxy
proxy=http://proxy.example.com:8080
https-proxy=http://proxy.example.com:8080

# ข้ามการตรวจสอบ SSL
strict-ssl=false

# กำหนดระดับของ log
loglevel=info

# ตั้งค่าให้บันทึก lockfile
lockfile=true

# กำหนดให้ใช้ package.json ที่อยู่ใน workspace root
workspace-root=true

# ตั้งค่าให้ใช้ peerDependencies แบบ strict
strict-peer-dependencies=true

# กำหนดให้ใช้ Node.js builtins แทนที่จะติดตั้งแพ็คเกจ
node-linker=hoisted

# ตั้งค่าให้แชร์ dependencies ระหว่าง workspaces
shared-workspace-lockfile=true

Released under the MIT License