browserslist config 파싱 - #10
Conversation
| const reader = cosmiconfigSync('browserslist') | ||
| const browserslist = reader.search(cwd) | ||
| if (browserslist) { | ||
| return browserslist.config | ||
| } | ||
| const packageJSONPath = path.join(cwd, 'package.json') | ||
| const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8')) | ||
| if ('browserslist' in packageJSON) { | ||
| return packageJSON.browserslist | ||
| } |
There was a problem hiding this comment.
There was a problem hiding this comment.
https://github.com/cosmiconfig/cosmiconfig 이게 다 해줄겁니다..
There was a problem hiding this comment.
아하??? 그러면 package.json을 읽을 필요가 없군요!
저거 cwd (기존 packageDir)은 안넣어도 되나요?
There was a problem hiding this comment.
https://github.com/cosmiconfig/cosmiconfig?tab=readme-ov-file#explorersearch 안넣어도 되는걸로 알고 있긴합니다?
| import {shouldInjectPolyfill} from './polyfill' | ||
|
|
||
| export interface ViteConfigProps { | ||
| cwd: string |
There was a problem hiding this comment.
보다 정확한 path를 읽기위해 package 사용처에서 current working directory를 주입 받습니다.
| @@ -1,19 +1,24 @@ | |||
| import browserslist from '@naverpay/browserslist-config' | |||
There was a problem hiding this comment.
browserlist config가 없다면, @naverpay/browserlist-config를 주입합니다.
✅ Changeset detectedLatest commit: af9ad02
If no version change is needed, please add The changes in this PR will be included in the next version bump. powered by: naverpay changeset detect-add actions |
|
요거 충돌 해결하고 올게여~ |
3d12300 to
6d0f81d
Compare
|
감삼다~ |
Related Issue
Describe your changes
Request