fix getWebpackConfig response if RUN_ENV is not dev #203
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.
In the
ant-design
main repository the response ofgetWebpackConfig
is expected to be an array:https://github.com/ant-design/ant-design/blob/9b6db94fdf1cd0cda0f3de0a1f127ac6fd2fc77d/webpack.config.js#L89
It's using
forEach
on it and also it's spread in module.exports further down:https://github.com/ant-design/ant-design/blob/9b6db94fdf1cd0cda0f3de0a1f127ac6fd2fc77d/webpack.config.js#L120
If the environment variable
RUN_ENV
is notPRODUCTION
though, it's returning the config object and no array.This PR fixes this inconsistency which breaks the build in case
RUN_ENV
is notPRODUCTION
, see error below:I checked the use of
getWebpackConfig
in the main repo and it seems that it's only used in thewebpack.config.js
file. Couldn't verify that this change doesn't break any other usage in other packages that might use this function.The alternative would be to verify that the config is an array in the main repo or transform the value to an array if it is not.