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(webpack): allow babel plugins to be defined by function #7443

Merged
merged 6 commits into from
Jun 3, 2020

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented May 31, 2020

This PR allows build.babel.plugins to be a function that receives context and returns Babel plugins.

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

With the new format for babel-polyfills it may be important to pass targets to Babel plugins, which will likely vary by isModern.

So, in line with the current presets configuration, it would be appropriate for plugins to take a function.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@pi0 pi0 requested a review from clarkdo May 31, 2020 21:01
@codecov-commenter
Copy link

codecov-commenter commented May 31, 2020

Codecov Report

Merging #7443 into dev will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #7443      +/-   ##
==========================================
+ Coverage   70.23%   70.25%   +0.01%     
==========================================
  Files          88       88              
  Lines        3699     3701       +2     
  Branches     1009     1010       +1     
==========================================
+ Hits         2598     2600       +2     
  Misses        893      893              
  Partials      208      208              
Flag Coverage Δ
#unittests 70.25% <100.00%> (+0.01%) ⬆️
Impacted Files Coverage Δ
packages/webpack/src/config/base.js 62.98% <100.00%> (+0.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35f3ad7...9ed9136. Read the comment docs.

Copy link
Member

@clarkdo clarkdo left a comment

Choose a reason for hiding this comment

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

Change looks good, can you please add some unit tests ?

@pi0 This may also needs ts type definition change?

@danielroe
Copy link
Member Author

@clarkdo I'm happy to put a PR into @nuxt/types with the updated type.

@clarkdo
Copy link
Member

clarkdo commented May 31, 2020

I think @pi0 is migrating types to core repo now.

@pi0
Copy link
Member

pi0 commented May 31, 2020

Types package is already moved here (#7432). Would be nice also updating it :)

@danielroe danielroe marked this pull request as ready for review May 31, 2020 22:04
@pi0 pi0 requested a review from clarkdo June 1, 2020 15:30
@pi0 pi0 changed the title feat: allow babel plugins to be defined by function feat(webpack): allow babel plugins to be defined by function Jun 3, 2020
@pi0 pi0 merged commit 0610f0b into nuxt:dev Jun 3, 2020
@pi0 pi0 mentioned this pull request Jun 10, 2020
@danielroe danielroe deleted the babel-plugins-ctx branch July 3, 2020 09:48
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants