description |
---|
Quick start your project using Berry. |
{% embed url="https://youtu.be/u7xAjqjp4fU?list=PLknn3jaIuWiDKKEy3EO-p5-MP1nSOgUr1" caption="Build and deploy berry" %}
If you prefer reading docs, continue reading below instead watching video.
Navigate to your root folder (i.e. berry-material-react)
c:\>cd berry-material-react
Install Packages by npm or yarn as per your preferences. Here we are using yarn
package manager.
c:\berry-material-react> yarn
After package installation, you can start your app by using yarn start
command
c:\berry-material-react> yarn start
This will start your local server at http://localhost:3000
Also, your terminal shows the following.
Compiled successfully!
You can now view berry-material-react in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.29.77:3000
Note that the development build is not optimized.
To create a production build, use yarn build.
This might be too early to deploy but it is always good to know how to deploy.
To build your app in production use yarn build
command
c:\berry-material-react> yarn build
or
c:\berry-material-react> npm run build
Change the base URL with your domain and build your application.
You can control this with the homepage
field in your package.json
{% code title="package.json" %}
"homepage" : "http://example.com"
{% endcode %}
To deploy it for subdirectory i.e http://example.com/subdirectory/
{% code title="package.json" %}
"homepage" : "http://example.com/subdirectory/"
{% endcode %}
You also need to set base-name in config.js
at '../src/config/'
{% code title="config.js" %}
basename: '/subdirectory'
{% endcode %}
{% hint style="info" %} You’ll need to have Node v12.x.x or later on your local development machine (but it’s not required on the server). You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects. {% endhint %}