Skip to content

Not issue. Just some thought about CRA. #3190

Closed
@raymondsze

Description

@raymondsze

Is this a bug report?

No

I love create-react-app and I am using it in the company projects.
But usually the choice of create-react-app cannot fulfill all our requirements.

As we all know, eject is not a good option.
Yes, I can fork the create-react-app and customize the react-scripts. But I have to maintain the fork and keep track of all the updates.

Someone ended up using react-app-rewired. It allows us to change the default configuration provided by creact-react-app with limited scope. But the overrides config have to be along with my web application project. It is not good to share the same build tools with teammate who might also working on react web project.

I believe that the default configuration provided by create-react-app is a good reference. But I also believe there are no perfect configuration unless the user create their own.

What I wonder is "Is it possible to provide a tool that let user extends the react-scripts to create their own react-scripts (Not tweak along with their react project) ?".
Let say, I just need to create a bin folder, and require the tool, then I can obtain the webpack and jest configuration that create-react-app provided, then I can do something to tweak the configuration. Publish it and use at my own risk.

Here are some features I would like to have but missing in create-react-app.

  1. Server side rendering, I think ssr is very important especially the product is in china market, the search engine is not google, javascript is not understandable to those search engine. Pre-render is just a workaround but not good solution. Here what I did is to tweak the webpack config with same manner of react-app-rewired (change the target to 'node' and libraryTarget to 'commonjs2').

  2. PWA, the default option of create-react-app is using 'Cache-first' policy. But 90% of times we want 'Network-first' to make user get the latest update. 'Cache-first' policy also have problem that the 'index.html' is being cached. Here what I did is to create separate script which call the 'workbox-cli' to generate the service worker.

  3. GraphQL, now the .graphql or .gql extensions are not understandable to create-react-app. Here what I did is to tweak the webpack and jest config with same manner of react-app-rewired (add graphql-tag/loader, and add jest-transform-graphql).

As you can see, I only need small modification to achieve my purpose...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions