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

refactor(legacy): build polyfill chunk #9639

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

sapphi-red
Copy link
Member

Description

This PR refactors how to skip esbuild transpilation.

This PR can be regarded as reverting #8660 + #9635 and applying a different fix.

IIUC this PR does not change the behavior.

refs #8660
refs #9635

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.

@sapphi-red sapphi-red added the p1-chore Doesn't change code behavior (priority) label Aug 11, 2022
Comment on lines +673 to 684
// Don't run esbuild for transpilation or minification
// because we don't want to transpile code.
esbuild: false,
optimizeDeps: {
esbuildOptions: {
// If a value above 'es5' is set, esbuild injects helper functions which uses es2015 features.
// This limits the input code not to include es2015+ codes.
// But core-js is the only dependency which includes commonjs code
// and core-js doesn't include es2015+ codes.
target: 'es5'
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Following up of the convo in #9635, I think esbuild: false make sense since you showed that core-js is already in es5, and same for systemjs (except it's now using const).

I don't quite understand the optimizeDeps.esbuildOptions.target part though since optimizeDeps is only for dev only for now, unless you're anticipating when we optimize in build too? I'd actually slightly lean to not optimize in build too then to simplify the bundling process 🤔

Copy link
Member Author

@sapphi-red sapphi-red Aug 12, 2022

Choose a reason for hiding this comment

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

Ah, yes, we could remove this for now.
#8660 was introduced when optimize in build was enabled by default. We'll need to add this or enable commonjs plugin when optimize in build is enabled by default.

Copy link
Member

Choose a reason for hiding this comment

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

Actually thinking now, maybe it wouldn't hurt leaving it in anyways, but it's definitely something to keep in mind when we completely remove the commonjs plugin

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.

Just to play safe, I think we can merge this one in the 3.1 beta. We should start it soon anyways.

@patak-dev patak-dev added this to the 3.1 milestone Aug 15, 2022
@patak-dev patak-dev merged commit 7ba0c9f into vitejs:main Aug 19, 2022
@sapphi-red sapphi-red deleted the refactor/legacy-polyfill-build branch August 20, 2022 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1-chore Doesn't change code behavior (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants