【问题标题】:How to extend create-react-app?如何扩展 create-react-app?
【发布时间】:2016-12-22 07:17:09
【问题描述】:

有没有办法用我自己的库、webpack 配置、点文件等来扩展美妙的create-react-app,但要保持最新?

我的意思是,我想eject 它,然后根据我的需要对其进行改进,但获得最新的更新不会有太大的痛苦,即手动跟踪 repo、查找差异、复制和粘贴等等。

【问题讨论】:

    标签: reactjs create-react-app


    【解决方案1】:

    是的,实际上你可以!你所做的是你 fork、修改和发布 react-scripts 并在使用 create-react-app 搭建脚手架时引用那些:

    $ create-react-app my-app --scripts-version react-scripts-fork
    

    Here you can read more about react-scripts.

    Here is an article about how to fork and modify react-scripts to your own needs.

    custom-react-scripts 可能已经实现了您正在寻找的东西,即 SASS 或装饰器。 Here is an article about custom-react-scriptshere is the package

    【讨论】: