Hacker News new | ask | show | jobs
by oelmekki 3225 days ago
I always do that, actually. I see what is provided in the App.js file as just a placeholder, meant to be replaced. Since you have webpack, you can import files from all over the place, deciding how to organize your project. It works just fine without ejecting :)
1 comments

I think the issue the parent is referring to is that CRA's Webpack configs only define a single "entry point", for your index.js, where each entry point becomes a separate bundle in and of itself. Having multiple entry points, like an "app page" and an "admin page", would require editing the Webpack config, which CRA deliberately keeps abstracted and hidden away until you eject.

If you really want to be able to modify the Webpack config for a CRA app, you have a couple other options besides ejecting:

- Create your own custom fork of the react-scripts ( https://github.com/facebookincubator/create-react-app/tree/m... ) package that CRA uses

- Use the react-app-rewired (https://github.com/timarney/react-app-rewired) tool , which lets you override parts of the build config within your project.

Oh, you're right, thus the "huge js file". Thanks for pointing it.