-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feat: Allow devServer.watchConfig to be configured #516
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #516 +/- ##
==========================================
+ Coverage 95.41% 95.42% +<.01%
==========================================
Files 97 97
Lines 1266 1267 +1
Branches 262 262
==========================================
+ Hits 1208 1209 +1
Misses 56 56
Partials 2 2
Continue to review full report at Codecov.
|
scripts/create-server.js
Outdated
| stats: webpackConfig.stats || {}, | ||
| }); | ||
| { | ||
| watchOptions: webpackConfig.devServer ? webpackConfig.devServer.watchOptions : {}, |
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.
I think this part isn’t required because webpack-merge should do recursive merge.
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.
I'm sorry, not quite sure what you mean here. Would you like to merge the entire webpackConfig.devServer into the styleguidist dev server config, not just watchConfig? Here I am checking for devServer being defined in the user config so it doesn't throw when it isn't.
I have not used webpack-merge before, so I am assuming it works like Object.assign in most cases
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.
I’d try to remove this whole second block and see if it still works because webpack-merge does recursive merge and it should work ;-)
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.
Ah, I see! Thanks for the ELI5. It does seems to work without the last block because of the recursive merging.
docs/Cookbook.md
Outdated
| </div> | ||
| ``` | ||
|
|
||
| ## How to use Vagrant with styleguidist? |
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.
styleguidist → Styleguidist
docs/Cookbook.md
Outdated
|
|
||
| First of all, make sure you read [this guide](https://webpack.js.org/guides/development-vagrant/) from the webpack documentation. | ||
|
|
||
| The article mentions that you need to use `--watch-poll` when using the |
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.
I’d write it shorter like this:
Then enable polling in your webpack config:
|
And thanks for the pull request! 🍕 |
This also means Vagrant is now supported
|
Amended the commit with your requested changes |
## New features ### Copy pathline to clipboard button  (#485, #471 by @SaraVieira) ### Easier way to override style guide React components New config option `styleguideComponents` to override React components used to render a style guide. ```javascript module.exports = { styleguideComponents: { Logo: path.join(__dirname, 'styleguide/components/Logo'), StyleGuideRenderer: path.join(__dirname, 'styleguide/components/StyleGuide'), }, }; ``` (#504) ### Customizable logging New `logger` option: ```javascript module.exports = { logger: { // One of: info, debug, warn // Suppress messages info: () => {}, // Override display function warn: message => console.warn(`NOOOOOO: ${message}`), }, }; ``` (#472, #510) ## Bug fixes * Allow `devServer.watchConfig` to be configured, this also means Vagrant is now supported (#515, #516 by @esphen) * Default `getExampleFilename` should be case-insensitive (#423, #460, #440, #482) * Allow dynamic JSS styles * Isolate search placeholder styles (#509, #491 by @n1313)
Why
Currently, Vagrant with the VirtualBox provider does not work with styleguidist, as there are issues with webpack's default behavior. The way around this is to make webpack use a polling scheme for checking for changed files. This is currently not configurable in styleguidist.
How
This PR makes the
devServer.watchConfigconfigurable so that it is possible to use styleguidist with VagrantFixes #515