Skip to content

browserslist config 파싱 - #10

Merged
2-one-week merged 10 commits into
mainfrom
repo/9_cosmic
Dec 23, 2024
Merged

browserslist config 파싱#10
2-one-week merged 10 commits into
mainfrom
repo/9_cosmic

Conversation

@2-one-week

Copy link
Copy Markdown
Member

Related Issue

Describe your changes

  • browserslist config 파싱을 통한 target 설정

Request

@2-one-week 2-one-week self-assigned this Dec 12, 2024
Comment on lines +7 to +16
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
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

먼저 consmic config를 읽고, package.json을 읽게 했습니다.

@yceffort-naver

혹시 browserlist.config.js 도 읽어야 할까요?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/cosmiconfig/cosmiconfig 이게 다 해줄겁니다..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하??? 그러면 package.json을 읽을 필요가 없군요!

저거 cwd (기존 packageDir)은 안넣어도 되나요?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/cosmiconfig/cosmiconfig?tab=readme-ov-file#explorersearch 안넣어도 되는걸로 알고 있긴합니다?

import {shouldInjectPolyfill} from './polyfill'

export interface ViteConfigProps {
cwd: string

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

보다 정확한 path를 읽기위해 package 사용처에서 current working directory를 주입 받습니다.

@@ -1,19 +1,24 @@
import browserslist from '@naverpay/browserslist-config'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

browserlist config가 없다면, @naverpay/browserlist-config를 주입합니다.

@npayfebot

npayfebot commented Dec 12, 2024

Copy link
Copy Markdown
Contributor

✅ Changeset detected

Latest commit: af9ad02

@naverpay/pite package have detected changes.

If no version change is needed, please add skip-detect-change to the label.

The changes in this PR will be included in the next version bump.

powered by: naverpay changeset detect-add actions

@yceffort-naver yceffort-naver left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다!

@keemhyunseok keemhyunseok left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㄱㄱㄱ

@2-one-week

Copy link
Copy Markdown
Member Author

요거 충돌 해결하고 올게여~

@keemhyunseok keemhyunseok left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감삼다~

@2-one-week

Copy link
Copy Markdown
Member Author

감삼다~

@2-one-week
2-one-week merged commit 94503d6 into main Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants