-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Fix #201: Enforce -loader suffix when processing loaders to handle old & new Webpack compatibility #205
Conversation
1. Please include a CHANGELOG entry for this one.
2. We need to remove any restrictions on the upper bound for webpack from the examples directory.
@Judahmeek, please review. Reviewed 4 of 4 files at r1. src/utils/processStyleLoaders.js, line 27 at r1 (raw file):
How about putting all of the above into a separate function, taking one param, loaders? Comments from Reviewable |
@justin808
|
@Judahmeek Any chance that you can verify all the examples work with the latest webpack? @robwise @alexfedoseev We should use this in F&G. Reviewed 13 of 13 files at r2. src/utils/processStyleLoaders.js, line 20 at r2 (raw file):
I would put this as a function above the default export. I don't think having an inline function makes this more readable. What's your opinion? Comments from Reviewable |
@justin808, About moving the function above the default export for readability - makes sense, I agree. It's a bit verbose to be inline. I'll update this branch accordingly. I manually ran all the examples last night, seems to work for basic & css-modules - dev & prod versions. I think there's an error with the |
…essStyleLoaders.js
@justin808 Since Also, I updated all of the example bootstrap config files to use the |
Hey, |
@nappynapster It's pretty much ready now, just need @justin808 and @Judahmeek to verify that it's ready to be merged in. |
I'll release. @nappynapster Can you also verify the examples are working? Reviewed 7 of 7 files at r3. Comments from Reviewable |
Released 2.0.0-beta.15. @alexfedoseev @robwise you probably want this in https://www.friendsandguests.com. |
Great, thanks @justin808! |
Summary:
The latest build of Webpack (v2.1.0-beta.26) requires loaders be explicitly stated with the
-loader
suffix, thus causing bootstrap-loader to no longer be compatible due to use of shorthand loader names.This PR fixes #201.
Fix Proposed:
This PR handles both cases, with or without
-loader
, to keep compatibility with old webpack users that omit the-loader
suffix. To do so, I'm proposing the following changes:.bootstraprc
are checked for a-loader
suffix using regex to find for compatible style loaders..bootstraprc
is missing the-loader
suffix, it replaces the short name with the name +-loader
. Otherwise, it returns the original loader name if it passes the suffix test.buildExtractStyleLoaders
, the fallback loader now comes with the-loader
suffix. Kudos to @silveryiris for this original solution. see Webpack v2.1.0-beta.26 - Breaking changes with loaders #201 (comment)Test Plan:
buildExtractStylesLoader.test.js
andprocessStyleLoaders.test.js
have both been updated to reflect these new changes and test correctly for the new-loader
suffix. This should pass the requirement in Webpack v2.1.0-beta.26.Some additional configuration work will be required to bring the examples up to par with beta.26, however to keep the scope of this PR controlled to the functionality of
-loader
suffix handling, that work is not included in this PR. I can follow up with another PR for proper beta.26 configuration for the examples.cc: @justin808
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)