question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customize webpack paths (src/build)

See original GitHub issue

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 😃

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
gaearoncommented, 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.

0reactions
sebaldcommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve | webpack
Configure how modules are resolved. For example, when calling import 'lodash' in ES2015, the resolve options can change where webpack goes to look...
Read more >
How to change all href and src paths on webpack building?
And to receive the same with hrefs and urls. I made a webpack build config and setted output.publicPath to '/path/to/' but it changed...
Read more >
How to Create a Path Alias in Webpack - Bitovi
Path aliases streamline your development process! In this post: how to use Webpack to implement path aliases with TypeScript and Storybook.
Read more >
A Simple Webpack Config | Aleksandr Hovhannisyan
And then create this simple webpack config under config/ : const path = require('path'); module.exports = { context: path.resolve('src/'), ...
Read more >
Adding a Custom webpack Config - Gatsby
build -html: production build static HTML pages. Check webpack.config.js for the source. There are many plugins in the Gatsby repo using this API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found