Treats

Treats

  • Getting Started

›Main Concepts

Getting Started

  • Installation

Tutorial

  • 01. Creating Your First Page
  • 02. Using Redux
  • 03. Using GraphQL
  • 04. Fetch Data for SSR
  • 05. Adding Addons

Main Concepts

  • Overview
  • Routing
  • Localization
  • Code-splitting
  • Redux
  • GraphQL Client
  • Middlewares
  • Helpers
  • Server-side Events
  • Server-side Template
  • Server-side Rendering
  • Custom Server App
  • Custom Client Initialization
  • Custom React App
  • Runtime Config
  • Build Config
  • Environment Variables
  • Code Generator
  • Scripts
  • Addons
  • Typescript
  • Workbox

API Reference

  • Overview
  • Filesystem Hooks
  • Components
  • Server
  • Client
  • Router
  • Intl
  • Locale Data
  • Helmet
  • Redux
  • Graphql

Authoring Addons

  • Overview
  • Helpers
  • Middlewares
  • Generators
  • Wrapping Up

Addons

  • Treats Addons List

Contributing

  • How To Contribute

FAQ

  • FAQs

Build Config

Treats Build config are used to configure Treats at compile & bundle time, you can supply these configuration by providing treats.config.js on your project directory. If you use create-treats-app, the default had already been configured for you:

//treats.config.js
const path = require("path");

const config = {
    app: {
        name: "my-treats-app",
        slug: "my-treats-app"
    },
    alias: {
        "@page": path.resolve(__dirname, "./src/page")
    }
};

module.exports = config;

There's several configuration that could be setup here:

  • app - App meta related configuration, this config would be supplied to Treats generator when it is used.
    • name name of the app
    • slug of the app
  • alias - You could register alias on your project here.
  • build - This configuration would be used to configure your build
    • graphql - if value is false graphql client codes won't be included on your build.
    • redux - if value is false redux codes won't be included on your build.
  • webpack - This configuration can be used to extends Treats webpack setup
    • publicPath - This value would override publicPath definition for your asset files.
    • client - This value would be merged to Treats client Webpack configuration using webpack-merge
    • server - This value would be merged to Treats server Webpack configuration using webpack-merge
    • workbox - This configuration can be used to enable and setting workbox configuration in treats. More info on workbox configuration can be seen on here
  • postcss -This configuration can be used to extends Treats PostCSS setup
  • babel -This configuration can be used to extends Treats Babel setup. All values would be merged to treats babel config using babel-merge
← Runtime ConfigEnvironment Variables →
Tokopedia Open Source
Copyright © 2019 Tokopedia OSS