JavaScript

scripts 유닉스 -> 윈도우

폴리프레임 2024. 7. 16. 12:14
반응형
"scripts": {
    "watch": "npm run build && node_modules/http-server/bin/http-server dist -p 1234 ",
    "build": "mkdir -p dist/ && cp index.html dist/ && cp index.js dist/"
  },

유닉스 기반으로 작성된 scripts 를 윈도우로 옮길 때 주의 해야 하는 것이 두가지 있습니다.

1. "/" --> "\\"

2. cp --> copy

"scripts": {
    "build": "mkdir dist && copy index.html dist\\ && copy index.js dist\\", 
    "watch": "npm run build && npx http-server dist -p 1234" 
}

(윈도우 환경에서는 http-server 명령어를 실행하려면 npx를 사용해야 합니다.)