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

feat: relax dep browser externals as warning #9837

Merged
merged 1 commit into from Aug 25, 2022

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Aug 25, 2022

Description

I believe this fixes #9200. I haven't tested it's repro but this PR likely fixes it.

The issue is that in Vite 3, we're stricter on deps that import nodejs modules by erroring when accessed. In Vite 2, there were simply undefined (even though we have a error proxy, esbuild's cjs-esm conversion bypasses it). This PR relaxes the error as a warning.

Additional context

Looks like the reason deps access them, even if there are browser friendly is because they are doing a "try import and test if exist" flow, which isn't a great technique for browser compatibility. They should not use the nodejs module at all via browsers and exports field.

For now this should unblock them, but still with a warning.


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.

@bluwy bluwy added the p3-significant High priority enhancement (priority) label Aug 25, 2022
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

Maybe if this is still too noisy, we could use console.debug here? For the moment, let's go forward with this change. @bluwy I think it could be good to backport it to the v3.0 branch too.

@patak-dev patak-dev enabled auto-merge (squash) August 25, 2022 13:30
@patak-dev patak-dev merged commit 71cb374 into main Aug 25, 2022
@patak-dev patak-dev deleted the relax-dep-browser-external branch August 25, 2022 13:35
@bluwy
Copy link
Member Author

bluwy commented Aug 25, 2022

I think noisy would be good so it's obvious that the package isn't published right. If 3.1 is taking a bit longer I can port it back to 3.0 too, but I also hope we can keep a more linear history for now 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-significant High priority enhancement (priority)
Projects
None yet
2 participants