File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -38,20 +38,28 @@ function patchWebpackStyleRules(rule) {
3838 }
3939}
4040
41+ function patchWebpackConfig ( config , { isServer } ) {
42+ if ( isServer ) {
43+ patchServerWebpackConfig ( config )
44+ } else {
45+ patchClientWebpackConfig ( config )
46+ }
47+ return config
48+ }
49+
4150function withGlobalCss ( ) {
4251 return ( nextConfig ) => {
4352 const config = {
4453 webpack : ( config , { isServer } ) => {
45- if ( isServer ) {
46- patchServerWebpackConfig ( config )
47- } else {
48- patchClientWebpackConfig ( config )
49- }
50- return config
54+ patchWebpackConfig ( config , { isServer } )
5155 } ,
5256 }
5357 return { ...nextConfig , ...config }
5458 }
5559}
5660
57- module . exports = { withGlobalCss }
61+
62+ module . exports = {
63+ withGlobalCss,
64+ patchWebpackConfig
65+ }
Original file line number Diff line number Diff line change @@ -30,6 +30,19 @@ module.exports = withConfig({
3030})
3131```
3232
33+ ** If your webpack configuration is already customized:**
34+ ``` js
35+ const { patchWebpackConfig } = require (' next-global-css' )
36+
37+ const nextConfig = {
38+ /* config options here */
39+ /* your already customized webpack option */
40+ webpack : (config , options ) => {
41+ patchWebpackConfig (config, options)
42+ },
43+ }
44+ ```
45+
3346## 📜 License
3447
3548Project is [ MIT licensed] ( https://github.com/yarastqt/next-global-css/blob/master/license.md ) .
You can’t perform that action at this time.
0 commit comments