-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Webpack 5 support #1903
Webpack 5 support #1903
Conversation
dep(webpack-cli): upgrade to latest ^3 dep(webpack-dev-server): upgrade to latest ^3 fix(webpack-dev-server): do not inject HMR since webpack-dev-server@^3 and ^4 will automatically inject HMR
This comment has been minimized.
This comment has been minimized.
If possible, I would like to get more 👀 on a webpack 5 compatible version. Can someone release a next version with these changes? If so, I can clean this up. Let me know! |
Heyo! v12 finally landed!. I'll get this updated, tested against my use-case, and then trim the artifacts (I don't really git-rebase so let me know if you need a pristine log history). |
@@ -119,8 +119,6 @@ export default function ( | |||
} | |||
} else { | |||
webpackConfig = merge(webpackConfig, { | |||
entry: [require.resolve('react-dev-utils/webpackHotDevClient')], | |||
plugins: [new webpack.HotModuleReplacementPlugin()], |
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.
AFAIK, this is automatically injected by the webpack dev server. My local dev environment seems to be auto-loading new code changes.
module.exports = { | ||
title: 'React Style Guide Example', | ||
components: 'src/components/**/*.js', | ||
webpackConfig, |
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.
It looks like this example was broken and needed to include the Webpack config. I'm not sure if I ran the example incorrectly.
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.
This shouldn't be necessary: Styleguidist finds webpack.config.js
in the project root.
This is ready for review.
|
This comment has been minimized.
This comment has been minimized.
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.
Thanks for the fixes!
Does it still work with webpack 4? If not, we should change the minimum version and release it as a major version.
module.exports = { | ||
title: 'React Style Guide Example', | ||
components: 'src/components/**/*.js', | ||
webpackConfig, |
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.
This shouldn't be necessary: Styleguidist finds webpack.config.js
in the project root.
I think this might be a side-effect of running the example in a nested directory:
without an explicit Webpack configuration in the Styleguidist configuration results in:
|
…ed library for testing examples with current code
…ce it is automatically imported
@@ -24,7 +24,7 @@ | |||
"prop-types": "^15.6.1", | |||
"react": "^17.0.1", | |||
"react-dom": "^17.0.1", | |||
"react-styleguidist": "^11.1.1", | |||
"react-styleguidist": "file:../../", |
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 made this change to get the automatic Webpack configuration to work. This means you can run this particular package.json
from its directory and it will treat itself as the root directory. This also means it will use the current working compiled code for react styleguidist when running this example. I think that's a better experience for developers because you will want to make changes to the library and test them against a local example. /cc @sapegin
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.
cd examples/webpack
npm install
npm run build
npm run styleguide
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.
This is awesome!
If we're okay with the existing change set, I can go ahead and fix the merge conflicts. |
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.
🍨
Conflicts: examples/webpack/package-lock.json
@sapegin If you make a pre-release, I can test it out on my repository as well. |
Making a prerelease is way too much work for me (and I dont't have neither time nor motivation to do any open source now), so I'm merging it as is and praying that semantic-release still works ;-) Thanks for the fix! 🤗 |
Motivation
Allow a host application with Webpack 5 to use react-styleguidist.
Technical changes
react-dev-utils
to latest version v12 (supports Webpack 5)