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

Fixes issue #146. #147

Merged
merged 4 commits into from
Nov 29, 2017
Merged

Fixes issue #146. #147

merged 4 commits into from
Nov 29, 2017

Conversation

dawnmist
Copy link
Collaborator

  • Document the alternative module.exports options.
  • Discuss configuration options for Jest/Babel and when you may want to use Jest in package.json verses the 'jest' function in config-overrides.js
  • Document how to customise the configuration for the Webpack Dev Server.

* Document the alternative module.exports options.
* Discuss configuration options for Jest/Babel and when you may want to use Jest in package.json verses the 'jest' function in config-overrides.js
* Document how to customise the configuration for the Webpack Dev Server.
@Guria
Copy link
Collaborator

Guria commented Nov 28, 2017

Awesome. Still needs some review to fix minor grammar issues. But content very descriptive indeed.

I would also add another way to manage overrides in folder instead of single file by creating config-overrides/index.js. See my boilerplate as reference.

Probably we may note that currently it is very hard to override entry-point. In CRA it defined in path.js.
But we can't just patch it, because require.cache is dropped in env.js. We can't just override entry in webpack config too, because entry defined in paths is used by other scripts.
In typescript boilerplate I [had to leave index.js as entry point and just import index.ts from it as a workaround. Another way I found just now is to short-circuit checkRequiredFiles utility to return always true.

@dawnmist
Copy link
Collaborator Author

Good point on overriding the entry point - I worked around it by using react-scripts-ts instead of react-scripts (which meant it was set up for index.ts by default), but that means that I'm using the --scripts-version option for react-app-rewired which is also not documented in the Readme file. I'll add in some documentation for using a config-overrides directory, description on why its hard to override the entry-point with , and on using --scripts-version to set react-app-rewired to use a custom version of react-scripts.

@Guria
Copy link
Collaborator

Guria commented Nov 28, 2017

In --scripts-version docs we can mention file paths that we rely on in our scripts:

  • config/env
  • config/webpack.config.dev
  • config/webpack.config.prod
  • config/webpackDevServer.config.js
  • scripts/build
  • scripts/start
  • scripts/test
  • scripts/utils/createJestConfig

* Update grammar in config-override object section
* Add an example showing some customisation inside each of the three object fields.
* Add a description of the issue with attempting to change the entry point for the app, and list some work-arounds that can be used.
* Document the --scripts-version option.
* Document the option of using a config-overrides directory.
README.md Outdated
```

React-app-rewired requires a custom react-scripts package to provide the following files:
* config/env
Copy link
Collaborator

@Guria Guria Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am only now noted that I forgot to add .js extension to files.

README.md Outdated
By default, the `override-config.js` file exports a single function to use when customising the webpack configuration for compiling your react app in development or production mode. It is possible to instead export an object from this file that contains up to three fields, each of which is a function. This alternative form allows you to also customise the configuration used for Jest (in testing), and for the Webpack Dev Server itself.

```javascript
module.exports = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now we have 2 almost similar examples: here and in 4) Example object-style config-overrides.js section

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. I was working further down in the file, and had forgotten that I had already created an initial example. I've merged the details for the two into the first of the examples.

@Guria Guria merged commit a8e3edf into timarney:master Nov 29, 2017
@dawnmist dawnmist deleted the issues/#146 branch November 29, 2017 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants