Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: don't throw missing name error when lib.fileName exists #4726

Closed
wants to merge 1 commit into from

Conversation

y1d7ng
Copy link
Contributor

@y1d7ng y1d7ng commented Aug 25, 2021

Description

related issue #4698

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@vwkd
Copy link
Contributor

vwkd commented Aug 25, 2021

Hey, nice fix! Thanks!

I saw it too late before posting #4729.

One thing that I noticed is that getPkgName could be computed lazily within the OR condition in resolveLibFilename, such that providing a libOptions.fileNamewouldn't require computing it at all thanks to short circuiting of the OR.

Feel free to draw inspiration from #4729.

EDIT: Also the error message would be more accurate if it was switched around, since the build.lib.fileName takes precedence now. Maybe something like

A name field in package.json is required if the option "build.lib.fileName" is not provided.'

@vwkd vwkd mentioned this pull request Aug 25, 2021
9 tasks
@Shinigami92
Copy link
Member

Pls see: #4729 (comment)

@y1d7ng
Copy link
Contributor Author

y1d7ng commented Aug 25, 2021

Hey, nice fix! Thanks!

I saw it too late before posting #4729.

One thing that I noticed is that getPkgName could be computed lazily within the OR condition in resolveLibFilename, such that providing a libOptions.fileNamewouldn't require computing it at all thanks to short circuiting of the OR.

Feel free to draw inspiration from #4729.

EDIT: Also the error message would be more accurate if it was switched around, since the build.lib.fileName takes precedence now. Maybe something like

A name field in package.json is required if the option "build.lib.fileName" is not provided.'

Thanks for your reply. I like your solution, and it's this issue you raised, welcome to contribute to vite. I close the pr.

@y1d7ng y1d7ng closed this Aug 25, 2021
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.

None yet

4 participants