Please use react-app-rewired if you want to customize CRA 1.
Please use customize-cra if you want to customize CRA 2.
Latest version of original react-scripts: 1.1.14
This is not a fork of
create-react-app
. It's just a fork ofreact-scripts
with simple babel/webpack modifications that can toggle extra features.
The reason for this fork's existence is explained better in this Medium article.
*the features are optional and can be turned on/off individually
create-react-app my-app --scripts-version custom-react-scripts
Modify the .env
file in the root of the generated project, and add any of the configuration options below
The generated project comes with every option turned on by default, but you can remove them at any time by removing the options from the .env
file.
npm uninstall --save react-scripts;
npm install --save custom-react-scripts;
Add a .env.
file with the desired features.
REACT_APP_SASS=true
- enable SASS supportREACT_APP_LESS=true
- enable LESS supportREACT_APP_STYLUS=true
- enable Stylus supportREACT_APP_CSS_MODULES=true
- enable CSS modulesREACT_APP_SASS_MODULES=true
- enable Sass modulesREACT_APP_LESS_MODULES=true
- enable Less modulesREACT_APP_STYLUS_MODULES=true
- enable Stylus modulesREACT_APP_CSS_MODULE_CLASSNAME_TEMPLATE='module-[sha512#⃣base32]-[name]-[local]'
- add custom CSS Module hash ident nameNote: to use modules the file must be named in the following format: $name.module.$preprocessorName
.
For example styles.module.css
or header.module.sass
or footer.module.less
, etc. Files that are not prefixed with module will be parsed normally.
REACT_APP_BABEL_STAGE_0=true
- enable stage-0 Babel presetREACT_APP_DECORATORS=true
- enable decorators supportREACT_APP_WEBPACK_DASHBOARD=true
- Enables connection to the webpack-dashboard Electron app (the app must be installed on local machine)The create-react-app
app doesn't allow user configuration and modifications for few reasons:
But people still want to use some of these features, and they're either ejecting their CRA app, or just don't use create-react-app
because they're just missing X feature.
So instead of searching npm for a react-scripts
fork with the X feature you need, this fork provides support for all of these extra features with simply adding a line in the .env
config.
The CRA team recently added support for an .env
file in the root of the generated CRA project.
From the original readme:
To define permanent environment vairables, create a file called .env in the root of your project:
REACT_APP_SECRET_CODE=abcdef
I just added support for extra environment variables that actually turn on certain plugins, babel plugins, presets, and loaders in the webpack and babel configs of react-scripts
.
I will put all of my efforts into supporting this fork to be always on par with features with the newest create-react-app
and react-scripts
versions.
在前面讲到了使用create-react-app来创建项目,这节我们来分析下原理。 react-scripts有以下支持,都帮你配置好了: React, JSX, ES6, and Flow syntax support. Language extras beyond ES6 like the object spread operator. Import CSS and image files
vue-cli及create-react-app 工具调研 vue-cli v3项目创建过程分析 vue-cli的运行命令为vue create [projectName] 在vue-cli项目v3分支中,找到package/@vue/cli/bin/vue.js,这个文件里定义了vue-cli的相关命令: program .command('create <app-name>') .de
目录 修改配置 多环境配置 package.json demo如下: 测试 使用 参考资料,感谢以下同学: 修改配置 可以通过 npm run eject 命令将配置文件暴露出来,然后去修改里面的webpack配置 安装 react-app-rewired 包后,在根目录创建 config-overrides.js 自定义配置,最后修改 package.json 中的 script
This is a follow up to my previous post about building a PWA with create-react-app (CRA). In the linked post, I discussed how we could go about building a custom Service Worker (SW) while staying with
默认情况下,npm start或yarn start将在端口3000上运行应用程序,并且没有在package.json.中指定端口的选项
JSF为开发人员提供了强大的功能来定义自己的自定义标记,可用于呈现自定义内容。 在JSF中定义自定义标记分为三个步骤。 步 描述 1a 创建一个xhtml文件,并使用ui:composition标签在其中定义内容 1b 创建标记库描述符(.taglib.xml文件)并在其中声明上面的自定义标记。 1c 在web.xml中注册标记libray描述符 步骤1a:定义自定义标签内容:buttonPane
自定义Drawables > 原文链接 : Custom Drawables 原文作者 : Ryan Harter 译文出自 : 开发技术前线 www.devtf.cn 译者 : SwinZh 校对者: Mr.Simple 状态 : 完成 我们都看过关于为什么你应该适当的使自定义Views和如何能帮助你正确的封装你的应用程序代码的帖子。但非视图相关的部分如何转化为我们apps的其他部分的这种思考方
The alter method can be used if you want to insert or remove rows and columns using external buttons. You can programmatically select a cell using the selectCell and load new data by loadData function
Registering a renderer Rendering custom HTML in cells Rendering custom HTML in header Registering a renderer When you create a renderer, a good idea is to assign it as an alias that will refer to this
You can easily pass id and other attributes to the hot-table wrapper element. It will be applied to the root Handsontable element, allowing further customization of the table.// app.component.ts impor