-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Custom additional webpack config? #99
Comments
I think @gaearon has previously replied somewhere that allowing custom config, let alone one tied to webpack specifics, will limit CRA's ability to iterate on defaults and potentially use a different bundler under the hood |
We're trying to avoid having configuration in the API. The reason there is an eject script is so that if you get to a point where you need some deeper configuration you can eject CRA and access webpack directly. |
well I guess you may know better but IMO you should provide the ability to tweak a few of the configs like public paths and environment variables. Speaking about environment variables reactpack allowed to have an Close this if you wish please |
We don't intend to provide Webpack specific overrides because it will be very fragile. People will start depending on specific loaders and plugins and we won't be able to improve the overall experience. We would like to encourage you to file issues about specific pain points you encountered. We understand you want to configure some things. Please help us understand what these things are, and why you want to configure them. We will look at those requests holistically and perhaps find another solutions, or maybe introduce some minimal configuration. |
@gaearon ok, for instance I have one project where I need |
Not sure I understand your point about gzip compression. It would be applied on the server anyway, right? So this shouldn't affect how you compile your assets. If you have other specific examples I am happy to discuss them in specific issues. |
My point is that in some cases we need opportunity add/remove
or
I don't say that we should have full |
As I said above we don't plan to provide any Webpack specific configuration. If you'd like to configure loaders or plugins, you are probably better served by other projects. You can find a big list of alternatives at the end of the README, and some of them support that. However we are happy to discuss specific use cases. For example, rather than "I needed to configure loaders" you could say "I needed SASS" or "I wanted to deploy my app at different paths", etc. This way we can keep those use cases in mind while planning future work. |
@gaearon What about specific options for |
If we make everything configurable, this tool will become another webpack. If you’re comfortable doing this, you can use
Can you please describe the use case? i.e. not what you want to tweak but why. Why do you need to tweak that option? What other options do you often tweak? |
@gaearon For example wanting to load bootstrap css in a specific order (before all other stylesheets are loaded so UI won't be messed up). |
Please file an issue about this use case and let's discuss it specifically. I'm happy to see specific use cases so we can look at ways of addressing them. In my experience there are often other ways of solving the same issues than adding configuration. |
This is possible to achieve today, though definitely unsupported. Automattic/wp-api-console#45 (comment) is an example for a production build, and it looks like something similar would work for the dev server too. |
This is exactly the case where instead of / in addition to reaching into internals it would be appropriate to file an issue describing the use case. I'd be happy to add Lodash plugin by default. If you add hacks please also start a dialogue. This way both your setup is more future proof and users can benefit from better defaults. Thanks! |
@gaearon Your patience is exemplary. |
Is it possible to somehow use absolute paths when importing modules, instead of relative, without ejecting? |
Hi @gaearon, How can I use https://www.npmjs.com/package/react-svg-loader ? Do I need to eject? |
SVG support was added in react-scripts 2.0. Please see the release announcement in the issue tracker. |
@Timer is it like react-svg-loader wrapping your svg in a react component are is it the very simple and |
You can do both.
|
@iansu it does not. // gives you undefined
import { ReactComponent as Logo } from './logo.svg'; I have just tested with :
|
This feature exists in the Please don't comment on old, closed issues. If you continue to have problems create a new issue. |
This would be helpful to set extra options to the config like publicPath and additional loaders as well as additional environment variables (I have a habit of using one for the public path).
One similar project, reactpack, that I used implemented this and I found it quite useful. They use webpack-merge if I am not wrong for merging the webpack configs.
The text was updated successfully, but these errors were encountered: