![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@bytedance/mona-runtime
Advanced tools
mona运行时
跳转组件,支持插件/应用间页面跳转
import { Link } from '@bytedance/mona';
const Index = () => {
return (
<div>
<Link to="/pages/home/index">navigate to home </Link>
</div>
)
}
export default Index;
参数 | 说明 | 是否必填 | 类型 | 默认值 |
---|---|---|---|---|
to | 要跳转的页面路由 | 是 | string | - |
路由跳转,跳转到新的页面
import { navigateTo } from '@bytedance/mona';
navigateTo('/pages/home/index')
路由重定向,跳转并替换当前页面路由
import { redirectTo } from '@bytedance/mona';
redirectTo('/pages/home/index')
创建项目配置,mona.config.ts
中使用
// mona.config.ts
import { createProjectConfig } from '@bytedance/mona';
export default createProjectConfig({
projectName: 'demo',
input: './src/app.tsx',
output: 'dist'
})
参数 | 说明 | 是否必填 | 类型 | 默认值 |
---|---|---|---|---|
projectName | 应用/插件名称 | 是 | string | - |
input | 入口文件路径 | 是 | string | - |
output | 打包后的文件目录路径 | 否 | string | - |
创建应用配置,app.config.ts
中使用
// app.config.ts
import { createAppConfig } from '@bytedance/mona';
export default createAppConfig({
pages: [
'pages/Home/index',
'pages/Info/index',
'pages/List/index'
]
})
参数 | 说明 | 是否必填 | 类型 | 默认值 |
---|---|---|---|---|
pages | 页面路径 | 是 | string[] | - |
创建页面配置,需在每个页面目录的page.config.ts
中使用
// page.config.ts
import { createPageConfig } from '@bytedance/mona';
export default createPageConfig({
navigationBarTitleText: 'page title'
})
参数 | 说明 | 是否必填 | 类型 | 默认值 |
---|---|---|---|---|
navigationBarTitleText | 当前页面标题 | 否 | string | - |
FAQs
Merchant app's developing and building tools
The npm package @bytedance/mona-runtime receives a total of 269 weekly downloads. As such, @bytedance/mona-runtime popularity was classified as not popular.
We found that @bytedance/mona-runtime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.