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: add hook build:config #6349

Merged
merged 1 commit into from
Sep 3, 2019
Merged

feat: add hook build:config #6349

merged 1 commit into from
Sep 3, 2019

Conversation

clarkdo
Copy link
Member

@clarkdo clarkdo commented Sep 3, 2019

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

I didn't add any param for now since we already have extend for customising webpack config and this hook should avoid introducing more side effects.

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.

@clarkdo clarkdo requested a review from a team September 3, 2019 17:33
@codecov-io
Copy link

Codecov Report

Merging #6349 into dev will decrease coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #6349      +/-   ##
==========================================
- Coverage   95.71%   95.68%   -0.04%     
==========================================
  Files          79       79              
  Lines        2662     2665       +3     
  Branches      685      686       +1     
==========================================
+ Hits         2548     2550       +2     
- Misses         98       99       +1     
  Partials       16       16
Flag Coverage Δ
#e2e 100% <ø> (ø) ⬆️
#fixtures 50.69% <66.66%> (+0.01%) ⬆️
#unit 92.34% <66.66%> (-0.03%) ⬇️
Impacted Files Coverage Δ
packages/webpack/src/builder.js 92% <66.66%> (-0.79%) ⬇️

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 f1edd82...22f0377. Read the comment docs.

@manniL
Copy link
Member

manniL commented Sep 3, 2019

I'm wondering whether we should be more explicit (e.g. webpackConfig) and use the new patter (builder:)?

Also, we need docs (as usual) explaining the difference between the different methods of adding stuff to the webpack config (e.g. via extends).

const additionalConfigs = await this.buildContext.nuxt.callHook('build:config')

if (additionalConfigs) {
webpackConfigs.push(...[].concat(additionalConfigs))
Copy link

Choose a reason for hiding this comment

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

Why the [].concat? If the array contains objects then after the concat its still an array to the same references right?

Copy link
Member Author

Choose a reason for hiding this comment

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

The concat here is for supporting return value either array or object as single or multiple builds

Copy link

Choose a reason for hiding this comment

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

Thanks, actually I didnt know you could return values with callHook. Maybe I am just overseeing something simple but there is no return statement or whatever, so how does it even return a value?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's true, it has been changed for a while, I've changed in new pr

@clarkdo
Copy link
Member Author

clarkdo commented Sep 3, 2019

@manniL Sorry, I don’t know the new hook pattern decision, is the new pattern corresponding to package? So maybe use hook name as ‘webpack:config’ ?

@clarkdo clarkdo merged commit 22f0377 into dev Sep 3, 2019
@clarkdo
Copy link
Member Author

clarkdo commented Sep 3, 2019

Will open another pr

@manniL
Copy link
Member

manniL commented Sep 3, 2019

y, I don’t know the new hook pattern decision, is the new pattern corresponding to package? So maybe use hook name as ‘webpack:config’ ?

#6329 (comment)

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.

5 participants