Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(add): add handling of merge option #797
fix(add): add handling of merge option #797
Changes from 8 commits
ce51a0a
d901d49
eb43443
66bde9f
ff67423
e5c7f67
2299848
ccf0dce
e839614
915c4ab
5778bdf
0782944
cb5a15f
e023d23
248b9cc
1323bbf
a2c49e2
88eec7c
cf85535
445ab31
b6a438d
b7ef7a4
55d237b
6a7e662
a89645a
5e23da2
27c6198
8b88980
cf8e3c9
7481974
8609b2b
8e3f4ae
5ee4169
d72ac08
57b47c3
8a66c21
0e0ba8a
7fe04e9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to parse this yourself. Extract this logic into a function
parseMergeConfig
, where you read the config, thewebpackOptions
is the module export of the config itself, you already have the filename frombasename(resolvedPath)
. I don't think that merge actually works like this. Merge takes a config name and attaches the name to a function.What you will need to do, is to make merge take in either
<Array>[name, path]
and add a require on top if the require is not in topScope (which I think is the best solution) or just add the name (bad DX).So what you'll need to do, is to have this in the object of the generator:
and make the function parseMerge ( https://github.com/webpack/webpack-cli/blob/master/packages/utils/ast-utils.ts#L608-L640 ) accept an array that will convert the first idx to the function parameter, the second one to a topScope property. You could use the existing API to make this happen more easily, and that is to make a require statement based on the indices and add that to topScope before running the transform. This will leave you with the same API as it is, but providing support for
merge
in add.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done @evenstensberg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Have a look at the comment further down