-
-
Notifications
You must be signed in to change notification settings - Fork 866
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
Lightweight eject #298
Comments
You are correct that this particular way of modifying razzle is very error prone and fragile. Instead of using the As for |
Quoting @jaredpalmer: (@ #325)
|
I don't like eject...it defeats the purpose of extracting configuration into a module. I like that you are providing hooks with |
Maybe we can do both? A modify option and an eject on top? For projects like CRA it makes sense to just only have a eject (I guess), but razzle has 5 different types of configs, so things will get overwhelming quick if that's the only option we provide. About the whole EventEmitter thing, how is this that much different from the current modify function we have? What advantages does it add? |
@jariz I guess it's not that much different than the A simple example might be something like this: import {RazzleTask} from 'razzle';
class MyProject extends RazzleTask {
constructor() {
super();
this.on('webpack:modify', (config) => {
config.module.use.push(/* some loader */);
})
}
} This would mutate the config and allow your task that did the emitting to continue on with the new config. Mutation is not amazing but ejecting is worse in my opinion. It's hard to make these extracted build modules configurable. I have an example here if you're interested |
Any news on this ? |
I much prefer keeping the modify function and adding a plugin system on top like suggested in #437. I'm not fan of adding a eject for the following reasons:
|
You lose a lot of buy-in when you refuse to provide an easy opt-out. |
I really like this project and the philosophy of not limiting the user by anything.
Escape hatches via
.babelrc
andrazzle.config.js
are good, but I somehow miss full control over the config. I know that I could easily fork this project and adapt the code to my needs, but this is not my goal (probably I am totally wrong and forking is this way to go).To explain my problem, take a look at the following use case. Let's say I want to handle SVG files differently in webpack than other media files (for instance with
svg-inline-loader
).As
svg
has been defined inrazzle/packages/razzle/config/create-config.js
Line 88 in eb22241
razzle.config.js
:As already mentioned in the comment, this adaption is error prone, as it will break if any new rules are added or the order of them are changed. It would be cool to have something like an
eject
command increate-react-app
, but probably only exposing the resulting webpack.config.js forprod
anddev
. Any thoughts?The text was updated successfully, but these errors were encountered: