Application Configuration#
The wis
project supports customizing your project through a configuration file. The project's configuration file is located in the wis.config.ts
file in the root directory of the project.
Configuration Options#
import type { WisConfig } from "@wisdesign/wis-plugin" const config: WisConfig = { name: "wis", browserRouter: false, libraryRegExp: /\/src\/packages/, remotes: {}, shared: [], exposes: {}, } export default config
name#
- Type:
string
- Default value:
name
inpackage.json
- Required:
No
Project name, used as the name when sharing resources externally.
browserRouter#
- Type:
boolean
- Default value:
false
- Required:
No
Whether to enable browser
routing. The default is hash
routing.
libraryRegExp#
- Type:
RegExp
- Default value:
None
- Required:
No
Useful when the project serves as a component library. When matched components use cssModule
, hash
values will not be automatically added.
remotes#
- Type:
Record<string, string>
- Default value:
None
- Required:
No
Register dependent remote
applications. For example, if you need to use the wis
component library, you need to register the wis
application.
export default { remotes: { wis: "https://static.wis.design" } }
shared#
Configure shared third-party libraries.
- Type:
string[] | Record<string, SharedConfig>
interface SharedConfig { singleton?: boolean; requiredVersion?: string; }
- Default value:
{ "react": { singleton: true, }, "react-dom": { singleton: true, }, "wiscore": { singleton: true, }, }
- Required:
No
exposes#
Configure modules to be exported for consumption by other projects.
- Type:
Exposes
enum Platform { PC = "pc", Mobile = "mobile", Pad = "pad", } type NormalExpose = string; interface PlatformExpose { [Platform.PC]: string; [Platform.Mobile]?: string; [Platform.Pad]?: string; } interface ClassifyRequired { default: string; } interface ClassifyOther { [key: string]: string; } type ClassifyExpose = Required<ClassifyRequired> & Omit<ClassifyOther, Platform>; interface PlatformClassifyExpose { [Platform.PC]: ClassifyExpose; [Platform.Mobile]?: ClassifyExpose; [Platform.Pad]?: ClassifyExpose; } type Exposes = { [key: string]: | NormalExpose | PlatformExpose | ClassifyExpose | PlatformClassifyExpose; };
- Default value:
None
- Required:
No
export default { exposes: { // Resource export NormalExpose "./Button": "./src/packages/Button", // Cross-platform set export PlatformExpose "./Button": { pc: "./src/packages/pc/Button", mobile: "./src/packages/mobile/Button", }, // Resource set export ClassifyExpose "./themes": { default: "./src/packages/themes/default", blue: "./src/packages/themes/blue", } // Cross-platform resource set export PlatformClassifyExpose "./themes": { pc: { default: "./src/packages/themes/pc/default", blue: "./src/packages/themes/pc/blue", }, mobile: { default: "./src/packages/themes/mobile/default", blue: "./src/packages/themes/mobile/blue", }, } }, }