Skip to content
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

Customize webpack paths (src/build) #879

Closed
sebald opened this issue Oct 9, 2016 · 6 comments
Closed

Customize webpack paths (src/build) #879

sebald opened this issue Oct 9, 2016 · 6 comments

Comments

@sebald
Copy link

sebald commented Oct 9, 2016

tl;dr; Are there any plans (or is there any demand) in making some paths customlizable? Like appIndexJs, appHtml or appBuild.


Context: The reason why I am asking this is that I am developing an app and wanted to use create-react-app to ease my way into working with React. Since the backend is a node server I want to share some code between client and server. Currently I have the folder setup like this:

project/
  src/
    client/
    server/
    shared/

I know about this example: https://github.com/fullstackreact/food-lookup-demo
The problem that I have with this setup is that webpack watchers would not automatically update/refresh when I change code in the shared folder. I know that I just can eject, but I want to profit from all the great updates! :)

So, I would like to change appIndexJs and appHtml to src/client/index.js/src/client/index.html.


Proposal: Add some configuration options to package.json to further configure create-react-app. This is done by other software already, e.g. ava.

This would allow (beside the "no-config" usage) to have some "advanced" configuration without ejecting. If this is something other people than me want, I would love to make a PR :)

@shrynx
Copy link
Contributor

shrynx commented Oct 10, 2016

@sebald Exactly my thoughts , Having a default yet configurable webpack would be really helpful. I am currently working on implementing this feature in my own repo (Hopefully will be done in a few hours.)
Gatsby (https://github.com/gatsbyjs/gatsby) provides this feature by leveraging Webpack configurator (https://github.com/lewie9021/webpack-configurator). Though i am preferring to use webpack-config(https://github.com/mdreizin/webpack-config) as it is more active.

@shrynx
Copy link
Contributor

shrynx commented Oct 10, 2016

For reference , this is from gatsby documentation
https://github.com/gatsbyjs/gatsby#how-to-use-your-own-webpack-loaders

@sebald
Copy link
Author

sebald commented Oct 10, 2016

@shrynx I think this is not part of the core-ideas of create-react-app. I guess my proposal isn't either, but I wanted to ask anyway :)

@shrynx
Copy link
Contributor

shrynx commented Oct 10, 2016

Oh yes definitely, That's why i am preferring on creating my own repo for this.
But there is thread regarding plugin system too , so maybe this could be useful
#670

@sebald
Copy link
Author

sebald commented Oct 10, 2016

Thanks for the link, that very interesting.

Just for reference: This is what I suggested https://github.com/sebald/create-react-app/commit/7407b19b7ec03410e8ee260101add60aa4ad0e05
Super minimal, but makes the package configurable/extensible.

@gaearon
Copy link
Contributor

gaearon commented Oct 10, 2016

Hi, thanks for the suggestion. I expect that we might look into the problem of sharing code as part of work on #741.

However we won't be adding configuration options for source and build output folder. If configuring them is important to you, we recommend that you use Webpack (or other tools) directly to have full control over your setup.

@gaearon gaearon closed this as completed Oct 10, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants