Create React apps with no build configuration.
- Creating an App – How to create a new app.
- Building an App – How to build an existing app.
- Injecting into WEKO3 module – How to injecting app-module into WEKO3 module.
- User Guide – How to develop apps bootstrapped with Create React App.
Create React App works on macOS, Windows, and Linux.
You don’t need to install or configure tools like webpack or Babel.
They are preconfigured and hidden so that you can focus on the code.
Create a new WEKO app module, and you’re good to go.
You’ll need to have Node 10.16.0 or later version on your local development machine (but it’s not required on the server). We recommend using the latest LTS version. You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.
To create a new app, you may choose one of the following methods:
npx create-react-app app-module-name
(npx is a package runner tool that comes with npm 5.2+ and higher, see instructions for older npm versions)
npm init react-app app-module-name
npm init <initializer>
is available in npm 6+
yarn create react-app app-module-name
yarn create <starter-kit-package>
is available in Yarn 0.25+
It will create a directory called app-module-name
inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
app-module-name
├── README.md
├── node_modules
├── package.json
├── public
│ ├── index.html
│ ├── favicon.ico
│ └── manifest.json
└── src
├── ModuleName.css
├── ModuleName.js
├── ModuleName.test.js
├── index.css
├── index.js
├── logo.svg
└── serviceWorker.js
└── setupTests.js
No configuration or complicated folder structures, only the files you need to build your app.
Once the installation is done, you can open your project folder:
cd app-module-name
Inside the newly created project, you can run some built-in commands:
Runs the app in development mode.
Open http://localhost:3000 to view it in the browser.
The page will automatically reload if you make changes to the code.
You will see the build errors and lint warnings in the console.
Runs the test watcher in an interactive mode.
By default, runs tests related to files changed since the last commit.
Install is used to install all dependencies for an app module. This is most commonly used when you have just checked out code for a module, or when another developer on the module has added a new dependency that you need to pick up.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed.
After process build, you can't found build results in app-module-name/build/static/
contained css
and js
folders.
Change that file's name following these rule:
-
In folder
css
:*.chunk.css --> app-module-name.chunk.css
-
In folder
js
:*.chunk.js --> app-module-name.chunk.js main.*.chunk.js --> app-module-name.main.chunk.js runtime-main.*.js --> app-module-name.runtime-main.js
Copy files above into corresponding folder in WEKO3's source:
module
├── weko-app-module
│ └── weko_app_module
| └── static
| ├── css
| | └── weko_app_module
| | └── *PUT CSS FILE HERE*
| └── js
| └── weko_app_module
| └── *PUT JS FILE HERE*
If something doesn’t work, please file an issue.
If you have questions or need help, please ask in GitHub Discussions.