# Class SubAppWebpackPlugin

This plugin will look for `declareSubApp` calls and do these:

1. instruct webpack to name the dynamic import bundle as `subapp-<name>`
2. collect the subapp meta info and save them as `subapps.json`

- Defined in plugins/subapp-plugin-webpack5.ts:153

#####
Index

### Constructors

constructor

### Properties

_assetsFile
_declareApiNames
_foundSubApps
_hasHmr
_makeIdentifierBEE
_subApps
_tapAssets
_webpackMajorVersion

### Methods

_applyHmrInject
apply
findImportCall
initWebpackVer5
updateAssets

## Constructors

### constructor

- new SubAppWebpackPlugin(options?): SubAppWebpackPlugin

- #### Parameters

  - options: {
    assetsFile?: string;
    declareApiName?: string | string[];
    webpackVersion?: number;
    } = {}

    subapp plugin options

    - ##### `Optional` assetsFile?: string

      Filename to output the subapp assets JSON file default: `subapps.json`

    - ##### `Optional` declareApiName?: string | string[]

      The API names for declaring subapp and components

    - ##### `Optional` webpackVersion?: number

      Webpack version

      minimum 5

  #### Returns SubAppWebpackPlugin

  - Defined in plugins/subapp-plugin-webpack5.ts:167

## Properties

### _assetsFile

_assetsFile: string

- Defined in plugins/subapp-plugin-webpack5.ts:159

### _declareApiNames

_declareApiNames: string[]

- Defined in plugins/subapp-plugin-webpack5.ts:154

### _foundSubApps

_foundSubApps: string

- Defined in plugins/subapp-plugin-webpack5.ts:161

### _hasHmr

_hasHmr: ((compilation) => boolean)

#### Type declaration

- - (compilation): boolean

  - #### Parameters

    - compilation: any

    #### Returns boolean

- Defined in plugins/subapp-plugin-webpack5.ts:160

### _makeIdentifierBEE

_makeIdentifierBEE: Function

- Defined in plugins/subapp-plugin-webpack5.ts:157

### _subApps

_subApps: Record<string, any>

- Defined in plugins/subapp-plugin-webpack5.ts:155

### _tapAssets

_tapAssets: Function

- Defined in plugins/subapp-plugin-webpack5.ts:158

### _webpackMajorVersion

_webpackMajorVersion: number

- Defined in plugins/subapp-plugin-webpack5.ts:156

## Methods

### _applyHmrInject

- _applyHmrInject(compiler): void

- Webpack 5 Reference:

  - lib/HotModuleReplacementPlugin.js

  #### Parameters

  - compiler: any

  #### Returns void

  - Defined in plugins/subapp-plugin-webpack5.ts:286

### apply

- apply(compiler): void

- #### Parameters

  - compiler: any

  #### Returns void

  - Defined in plugins/subapp-plugin-webpack5.ts:301

### `Private` findImportCall

- findImportCall(ast, source): any

- #### Parameters

  - ast: any
  - source: any

  #### Returns any

  - Defined in plugins/subapp-plugin-webpack5.ts:250

### initWebpackVer5

- initWebpackVer5(): {
  BasicEvaluatedExpression: any;
  hasHmr: (() => boolean);
  makeIdentifierBEE: ((expr) => any);
  tapAssets: ((compiler) => void);
  }

- #### Returns {
  BasicEvaluatedExpression: any;
  hasHmr: (() => boolean);
  makeIdentifierBEE: ((expr) => any);
  tapAssets: ((compiler) => void);
  }

  - ##### BasicEvaluatedExpression: any

  - ##### hasHmr: (() => boolean)

    - - (): boolean

      - #### Returns boolean

  - ##### makeIdentifierBEE: ((expr) => any)

    - - (expr): any

      - #### Parameters

        - expr: any

        #### Returns any

  - ##### tapAssets: ((compiler) => void)

    - - (compiler): void

      - #### Parameters

        - compiler: any

        #### Returns void

  - Defined in plugins/subapp-plugin-webpack5.ts:203

### updateAssets

- updateAssets(assets): void

- #### Parameters

  - assets: any

  #### Returns void

  - Defined in plugins/subapp-plugin-webpack5.ts:223