This repository has been archived by the owner on Dec 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8fa2fc
commit 0b94300
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
- Start Date: 2020-04-18 | ||
- RFC PR: | ||
- Gatsby Issue: | ||
|
||
# Summary | ||
|
||
As many gatsby recipes gets built those recipes might need to override the webpack config to support features like LESS support or may want to modify options to a loader to accomplish it. | ||
|
||
# Basic example | ||
|
||
```mdx | ||
# Add Ant Deisgn | ||
|
||
Installing necessary packages | ||
|
||
<NPMPackage | ||
name={"atd"} | ||
/> | ||
|
||
<NPMPackage | ||
name={"less-loader"} | ||
/> | ||
|
||
Updating webpack config | ||
|
||
<WebpackLoader test={/\.less$/} use={ | ||
(loaders) => ([ | ||
loaders.miniCssExtract(), | ||
loaders.css({ importLoaders: 1 }), | ||
loaders.postcss(), | ||
`less-loader`, | ||
]) | ||
} /> | ||
|
||
<WebpackPlugin | ||
plugin={{ | ||
__DEVELOPMENT__: stage === `develop` || stage === `develop-html`, | ||
}} | ||
/> | ||
|
||
--- | ||
|
||
# Motivation | ||
|
||
This would help in building the recipes easier which require to update the webpack config by adding loaders, plugins etc. | ||
|
||
# Detailed design | ||
|
||
The design will be very similar to other providers and will be overriding the webpack config | ||
|
||
# Drawbacks | ||
|
||
- We need to update the API of the component whenever there are changes to the Webpack API | ||
|
||
Why should we *not* do this? Please consider: | ||
|
||
- Could not think about any but love to hear if I missed anything here | ||
|
||
# Alternatives | ||
|
||
We can also just put up a single component saying | ||
|
||
```mdx | ||
import config from './webpack.config'; | ||
|
||
<WebpackConfig config={config}> | ||
``` | ||
|
||
With the above design the API of the provider does not change with API of webpack but it takes away the declarative nature of JSX. | ||
|
||
# Adoption strategy | ||
|
||
- We need to follow the same strategy as we do for other providers | ||
|
||
# How we teach this | ||
|
||
- With simple examples for building recipes | ||
- Comparison doc between what config gets generated when we use a particular JSX tag | ||
|
||
# Unresolved questions | ||
|
||
- How far can we provide the same composability and flexiblity that we can provide through JSX that users are used to when writting webpack config in plain JavaScript. |