target is set to web, MorJS uses @morjs/plugin-compiler-web to produce a standard HTML + JS + CSS web application from your mini-program source. All web-specific options live under the web key in your config.
mor.config.ts
All fields in this section are nested under the
web key. They have no effect when compiling to mini-program targets.How web compilation works
MorJS transforms mini-program templates (WXML/AXML), scripts, and styles into web-compatible output:- Templates — Converted from WXML/AXML into web component markup using
@morjs/runtime-web. - Styles —
rpxunits are converted toremby default, enabling responsive scaling. - Scripts — Mini-program lifecycle APIs are shimmed via the web runtime’s API layer.
- Routing — Page routing is handled by the web runtime’s router module.
- Assets — Files up to 8 KB are inlined as base64 data URIs; larger files are emitted separately.
Output
The default output directory for web builds isdist/web.
In production bundle mode, output filenames include a content hash:
Options reference
Layout and routing
Whether to show the navigation header bar on pages.
true— Show on all pages.false— Hide on all pages.string[]— Show only on the listed page paths.(pagePath: string) => boolean— Custom function for per-page control.
Whether to show a back button in the navigation header.
true— Show on all pages.false— Hide on all pages.string[]— Show only on the listed page paths.(pagePath: string) => boolean— Custom function for per-page control.
RPX unit conversion
Enable
rpx to rem conversion. When enabled, MorJS transforms rpx units in style files into rem values based on rpxRootValue. Pair this with the runtime setRootFontSizeForRem method for responsive scaling.The root
rem value used for rpx conversion. 1rpx equals 1/rpxRootValue rem.Convert When
rpx to px instead of rem. Useful for fixed-layout scenarios.ratio is 1, 1rpx = 1px. When ratio is 2, 1rpx = 0.5px.Automatically set the root font size for responsive layouts. The base screen width is 375px.
Style isolation
Add a unique hash suffix to all CSS class names to prevent style collisions between pages. Recommended for multi-page applications.
Assets
Maximum file size in bytes for assets to be inlined as base64 data URIs. Files larger than this value are emitted as separate files. Default is
8192 (8 KB).The base URL for all output asset references. Set this to match your deployment path, for example
/my-app/ for a subpath deployment.Entries
Automatically generate webpack entry files from your mini-program page and component structure. Disable this only if you need to manage webpack entries manually.
Custom webpack entry configuration. Only used when
autoGenerateEntries is false. You are responsible for assembling page imports and runtime initialization.Output intermediate compilation artifacts (pre-processed templates, scripts, and styles) alongside the final output. Useful for debugging the compilation pipeline.
Components
Override the default component name mapping for web output. Keys are mini-program component names; values are their web equivalents.
Extensions
API and component extension modules to load in the web runtime. Extensions customize or augment the web runtime’s behavior.
HTML output
Configuration for
html-webpack-plugin. Pass a single object for one HTML file, or an array of objects to generate multiple HTML entry pages.Configuration for
mini-css-extract-plugin. Controls how CSS is extracted into separate files.Dev server
Configuration for the webpack dev server. Accepts all webpack DevServer options.
App runtime config
Runtime configuration injected into
window.$MOR_APP_CONFIG. Consumed by the web runtime to customize behavior.Minimal web config example
mor.config.ts
Compiler options →
All compiler-level options that also apply to web builds, including aliases, defines, and TypeScript settings.