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
Get under control webpack config files. #691
Conversation
ref: issue about IE8 #692 |
noParse: /babel-core\/browser/, | ||
loaders: [ | ||
{ test: /\.js/, loader: `${reactHot}babel`, exclude: /node_modules|Samples\.js/ }, | ||
{ test: /Samples.js/, loader: `${reactHot}transform?brfs!babel` }, |
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.
One of the reasons I was doing a search for the loader I wanted to change was to allow changes in the base loader to cascade down. Since the base loader only has the one loader, how would you feel about including that as an export of the base and build these two on top of that one?
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.
will do it via jsLoader
export const jsLoader = 'babel';
{ test: /\.js/, loader: `${reactHot}${jsLoader}`, exclude: /node_modules|Samples\.js/ },
{ test: /Samples.js/, loader: `${reactHot}transform?brfs!${jsLoader}` },
Nice hint. Thank you!
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 the testing strategy, while useful during your refactor, is a bit too much. The slightest change to the base config would cause all the test cases to fail meaning simple changes would require modifications to each test case. I'd advocate for a few targeted test cases that check sections of the configuration and not the entire configuration in one glob. It would be nice if these tests were Mocha style tests, this way they can still be included in the existing test run. |
In general I welcome this change it is less complicated and easier to reason about. The initial approach I took was based on an internal implementation that we have on a much larger project. Which did not scale well here, so thanks for the good work on this @AlexKVal! |
Re-written.
I thought a lot about it before I created this PR. The whole idea behind this refactoring is from my 1.5 month wathing on this project. I believe that there is no any But at the same time every change will reveal every possible side effect 👍
I were tried it with karma as is, but existing tests run in browser. I decided to post it as is to get some feedback first. What do you think if we merge this version - with proposed fixes - and then refactor it with Mocha. I have a dread of additional changes in tools and configs in the meantime that would cause |
Anyway I'm already learning how to refactor it with Mocha. |
Hah.. As it turned out it wasn't painful 😄 actually only 98eb4c2 has been changed Added |
@@ -0,0 +1 @@ | |||
require('babel/register'); |
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.
Have you seen this: https://babeljs.io/docs/using-babel/#mocha
wow that new page is awesome (in babel) |
I still don't like the complete explicit configuration tests. If we are going to maintain them in such a verbose manner we may as well have the configs be that verbose and forego any kind of dynamic configuration. Those tests are incredibly brittle and will be required to change with every change to the base configuration. I'm ok with some unit tests that verify portions of the configurations like I've stated before, but I am not ok with them in the state they are now. The point of testing is to provide a good safety net so you don't hurt yourself. Note that I said "safety net", and not "safety sail". Every a net has a few holes, but are still very effective at catching fish. While at the same time not preventing the boat from moving with the net on its tow line. Forgive the commercial fishing example, but I hope that conveys what I'm getting at. |
Didn't know it. Thank you 🍒 Edited: part about tests has been moved to #706 PR. |
I propose to split this PR into two. I cut out into new PR #706 discussion about tests for webpack. And here I left (squashed) just new config files 🍒 |
Remove some stale `IE8` pieces.
LGTM |
Get under control webpack config files.
Yay 🎉 😃 |
…eact-bootstrap#691) Bumps [enzyme-adapter-react-16](https://github.com/enzymejs/enzyme/tree/HEAD/packages/enzyme-adapter-react-16) from 1.9.1 to 1.15.6. - [Release notes](https://github.com/enzymejs/enzyme/releases) - [Changelog](https://github.com/enzymejs/enzyme/blob/master/CHANGELOG.md) - [Commits](https://github.com/enzymejs/enzyme/commits/enzyme-adapter-react-16@1.15.6/packages/enzyme-adapter-react-16) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Scripts compiling webpack config files are somewhat convoluted now
and they are getting harder to maintain and understand
example
It all leads to confusions like this and this
Before refactoring I found some unused code.
I decided to not create standalone PRs for them.
They reside in standalone commits in this PR.
Removed extraneous
Removed unused
strategies/development.js
withdevtool: 'sourcemap’
instead of the right one
source-map
Then.
Every refactoring requires tests first.
It is not a trivial task to test
required or imported
.js
-files,becuase of that I've created a simplest standalone test suit for this.
Then I filled test-cases up from all currently used webpack configurations.
Tests are green. Now we can refactor scripts itself.
The new scheme is simplest as possible.
There is
base.conf.js
and all other configs are based on it.Command line args are parsed in
base
and then they are exported to children.Note:
// Remove extract text plugin from dev workflow so hot reload works on css
here
Actually plugin was not been removing.
Tests made it plain that it was just a stale comment.
Tests are the same but configs are new. All is green.
Finally: I've added check for webpack configs into
npm run test
for TravisCI.New webpack config generating scripts are much simpler and clean 🍒
And now about the IE8 configs.
IE8 dev part is totally broken.
Neither
npm run ie8
command works, because ofError: Cannot find module 'webpack-dev-middleware'
,nor files like ie8/package.json are used.
I removed
npm run ie8
command because it doesn't work nowand there is no fast fix for it at this stage.
I will create additional issue about IE8 state of things
where I will address all of it and some additional info.