## Index

### Type Aliases

- XarcCdnAssetsMappingOptions

### Properties

- isomorphicLoader

### Variables

- ETMP_DIR
- PROD_DIR
- xAppRequire

### Functions

- loadRuntimeSupport
- makeAppMode
- setupAppSrcDir
- setupIsomorphicCdnAssetsMapping
- setupIsomorphicLoader

## Type Aliases

### XarcCdnAssetsMappingOptions

XarcCdnAssetsMappingOptions: { extendRequire?: any; mapping?: Record<string, unknown>; prodOnly?: boolean }

- Defined in support.ts:57

Options for setting up CDN assets mapping

#### Type declaration

- ##### Optional extendRequire?: any

  isomorphic-loader extend require instance

  - if not provided, then the default instance is used

- ##### Optional mapping?: Record<string, unknown>

  assets mapping data

  - if not provided, then will try to load it from one of these files:
  1. dist/cdn-mappings.json
  2. config/assets.json

- ##### Optional prodOnly?: boolean

  Only setup in production mode (NODE_ENV === "production")

## Properties

### isomorphicLoader

isomorphicLoader: any

## Variables

### Const ETMP_DIR

ETMP_DIR: ".etmp" = ".etmp"

- Defined in constants.ts:2

### Const PROD_DIR

PROD_DIR: ".prod" = ".prod"

- Defined in constants.ts:1

### Const xAppRequire

xAppRequire: NodeRequire = require

- Defined in index.ts:8

This is the `require` from @xarc/app's directory.

## Functions

### loadRuntimeSupport

- loadRuntimeSupport(options?: XarcSupportOptions): Promise<any>

- - Defined in support.ts:221

  start node.js run time support for app server

  #### Parameters

  - ##### options: XarcSupportOptions = {}

    options on what runtime support to start

  #### Returns Promise<any>

  Promise

### makeAppMode

- makeAppMode(prodDir?: string, reactLib?: string): any

- - Defined in app-mode.ts:25

  Figure out the mode app is setup.

  1. src/client, src/server => lib
  2. src/{subapp-directories}, src/server => lib
  3. which react lib is being used (default react)

  And then setup the env APP_SRC_DIR so in dev mode code in src is executed with run time compiler like @babel/register, but in prod mode transpiled code in lib will be executed.

  #### Parameters

  - ##### prodDir: string = PROD_DIR

    directory to save data of the app mode

  - ##### reactLib: string = "react"

    UI framework (react)

  #### Returns any

  app mode data

### setupAppSrcDir

- setupAppSrcDir(): void

- - Defined in support.ts:156

  Setup APP_SRC_DIR when running node.js server

  - `src/` in development mode
  - `lib/` in production mode

  #### Returns void

  nothing

### setupIsomorphicCdnAssetsMapping

- setupIsomorphicCdnAssetsMapping(options?: XarcCdnAssetsMappingOptions): void

- - Defined in support.ts:85

  Setup assets mapping to CDN URLs

  #### Parameters

  - ##### Optional options: XarcCdnAssetsMappingOptions

    asset mapping options

  #### Returns void

  nothing

### setupIsomorphicLoader

- setupIsomorphicLoader(ignoreExtensions?: string | false | string[]): any

- - Defined in support.ts:130

  Load the require hook to support isomorphic assets when doing SSR

  #### Parameters

  - ##### ignoreExtensions: string | false | string[] = ".css|.scss|.sass|.pcss|.stylus|.styl|.less|.sss|.gif|.jpeg|.jpg|.png|.svg|.mp4|.webm|.ogv|.aac|.mp3|.wav|.ogg"

    when a require file is not found, and its extension is in this, then it will be considered an isomorphic asset and an empty `{}` will be returned for it to avoid failing with module not found errors.

    - Default `".css|.scss|.sass|.pcss|.stylus|.styl|.less|.sss|.gif|.jpeg|.jpg|.png|.svg|.mp4|.webm|.ogv|.aac|.mp3|.wav|.ogg"`
    - set to `false` to disable this and let module not found error to throw

  #### Returns any

  isomorphic require extender

Generated using TypeDoc