Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge: 合并鸿蒙分支 #16740

Merged
merged 92 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
f4e24da
fix: 支持关闭 jsx 样式注入,并提供 css map
ZakaryCode Jun 17, 2024
3aed7f4
Merge remote-tracking branch 'origin/feat/harmony' into feat/harmony-…
ZakaryCode Jun 17, 2024
2521d2d
chore(release): publish 4.0.0-alpha.24 --tag=alpha
ZakaryCode Jun 17, 2024
544f6ee
fix(vite): 修复组件模式配置缺失问题
ZakaryCode Jun 18, 2024
668fb93
chore(release): publish 4.0.0-alpha.25 --tag=alpha
ZakaryCode Jun 18, 2024
fff4578
feat: update from ets runtime
ZakaryCode Jun 20, 2024
164697d
chore(release): publish 4.0.0-alpha.26 --tag=alpha
ZakaryCode Jun 20, 2024
a2d86e3
feat(harmony): add terser plugin
ZakaryCode Jun 22, 2024
42256c6
chore(release): publish 4.0.0-alpha.27 --tag=alpha
ZakaryCode Jun 22, 2024
f43d441
Merge remote-tracking branch 'origin/feat/harmony' into feat/harmony-…
ZakaryCode Jun 24, 2024
acd1733
fix: 移除废弃插件
ZakaryCode Jun 25, 2024
ed47f42
feat(ets): 调整运行时导出
ZakaryCode Jul 4, 2024
bf00c41
feat: 更新 capi 版本 runtime
ZakaryCode Jul 8, 2024
a5dad29
feat(harmony): add cpp style
ZakaryCode Jul 8, 2024
3b9f6f3
Merge remote-tracking branch 'origin/feat/harmony' into feat/harmony-…
ZakaryCode Jul 8, 2024
558ff01
fix: 修复导出路径
ZakaryCode Jul 8, 2024
6f0a9d0
chore(release): publish 4.0.0-alpha.36 --tag=alpha
ZakaryCode Jul 8, 2024
70a1b59
fix(harmony): update runtime
ZakaryCode Jul 8, 2024
6e50b63
fix: 修复cssmodules匹配不到的问题
Jul 9, 2024
ef081c2
feat: comp.js 支持路由重命名
Jul 9, 2024
23ad401
feat: 去掉console
Jul 9, 2024
6e7bf35
fix: uid types
ZakaryCode Jul 9, 2024
65492ab
fix(harmony): 修复常量替换问题
ZakaryCode Jul 10, 2024
857720d
fix(harmony): 调整 api 依赖引用
ZakaryCode Jul 10, 2024
2bbf6ff
Merge remote-tracking branch 'origin/feat/harmony' into feat/harmony-…
ZakaryCode Jul 13, 2024
8f0575d
chore(release): publish 4.0.0-alpha.44 --tag=alpha
ZakaryCode Jul 13, 2024
77a16ed
fix(harmony): 移除 onpm 不能装载的类型
ZakaryCode Jul 13, 2024
0c84e3e
fix: 修复 input 事件错误逻辑
ZakaryCode Jul 13, 2024
85d21ad
fix: 修复 form 元素移除属性错误
ZakaryCode Jul 13, 2024
185d5c4
Merge remote-tracking branch 'origin/feat/harmony' into feat/harmony-…
ZakaryCode Jul 13, 2024
2724b8f
fix(react): env shake
ZakaryCode Jul 13, 2024
4aa3c7a
fix: 修复stickySection没有渲染list-item的问题
heiazu Jul 15, 2024
d1e47e9
chore(release): publish 4.0.0-beta.119 --tag=beta
heiazu Jul 15, 2024
cca7eed
fix: 修复list-view问题
heiazu Jul 15, 2024
0070416
chore(release): publish 4.0.0-beta.120 --tag=beta
heiazu Jul 15, 2024
d6a8ada
fix: 修复sticky-section没有被复用
heiazu Jul 15, 2024
959d097
Merge branch 'feat/harmony' of https://github.com/NervJS/taro into fe…
Jul 15, 2024
f25e908
Merge branch 'feat/harmony' of https://github.com/NervJS/taro into fe…
Jul 15, 2024
ad1d2e3
chore(release): publish 4.0.0-beta.121 --tag=beta
Jul 15, 2024
86a30a3
fix: 修复错误引入taro的问题
heiazu Jul 15, 2024
dd80148
chore(release): publish 4.0.0-beta.122 --tag=beta
heiazu Jul 15, 2024
fc9577e
chore(release): publish 4.0.0-beta.122 --tag=beta
heiazu Jul 15, 2024
99479f1
fix: 修复cssmodule样式不生效
heiazu Jul 15, 2024
affd6a4
chore(release): publish 4.0.0-beta.123 --tag=beta
heiazu Jul 15, 2024
cdbda96
fix: 临时修复 harmony 不能编译 ts 的问题
Jul 16, 2024
f8df7aa
Merge branch 'feat/harmony' of github.com:NervJS/taro into feat/harmony
Jul 16, 2024
dd9d31e
chore(release): publish 4.0.0-beta.124 --tag=beta
Jul 16, 2024
f9cf02a
fix: 兼容找不到页面情况
Jul 16, 2024
a672a79
fix(harmony): 优化 contextPromise 设置
ZakaryCode Jul 18, 2024
7f905a7
fix(harmony): 修复读取配置时缺少常量注入
ZakaryCode Jul 18, 2024
e026ed7
chore(release): publish 4.0.0-beta.125 --tag=beta
ZakaryCode Jul 18, 2024
101d5b2
fix: code
ZakaryCode Jul 18, 2024
7ef1418
feat(harmony): 修复图片等资源注入引用问题
ZakaryCode Jul 18, 2024
80aef2a
chore(release): publish 4.0.0-beta.126 --tag=beta
ZakaryCode Jul 18, 2024
5606d2b
fix: 修复 readConfig 时引入 babel 导致的问题
ZakaryCode Jul 22, 2024
f29bb74
fix: 更新 lint 问题
ZakaryCode Jul 22, 2024
1af4ae8
chore(release): publish 4.0.0-beta.127 --tag=beta
ZakaryCode Jul 22, 2024
f24e550
fix: 修复 readConfig 时引入 babel 导致问题
ZakaryCode Jul 22, 2024
1f527a2
chore(release): publish 4.0.0-beta.128 --tag=beta
ZakaryCode Jul 22, 2024
4b924f5
fix: 修复scroll无法禁止滚动的bug
heiazu Jul 25, 2024
799d88b
chore(release): publish 4.0.0-beta.129 --tag=beta
heiazu Jul 25, 2024
3192372
feat: 在style的opacity设置成空字符串里把他设置成1,避免harmony beta2把opacity的默认值设置成0的情况
Jul 25, 2024
ff4f3f8
chore(release): publish 4.0.0-beta.130 --tag=beta
Jul 25, 2024
dc21b68
fix: 修复鸿蒙端的pagaName获取不到的问题和ets的类型问题
Jul 25, 2024
00d3990
fix: 修改readConfig方法
Jul 23, 2024
ba717c9
chore(release): publish 4.0.0-beta.131 --tag=beta
Jul 25, 2024
843941d
fix: 修复beta2文本不更新的问题
heiazu Jul 26, 2024
f58dadf
chore(release): publish 4.0.0-beta.132 --tag=beta
heiazu Jul 26, 2024
52f162a
fix: 修复 overflow 是 scroll 和 auto 情况下 scrollview 不能滚动的问题
Aug 7, 2024
f3d6f64
Merge branch 'feat/harmony' of github.com:NervJS/taro into feat/harmony
Aug 7, 2024
1612f9b
chore(release): publish 4.0.0-beta.133 --tag=beta
Aug 7, 2024
dae6837
fix(types): update picker region data
ZakaryCode Aug 8, 2024
80bb090
fix(runner): 整理 page entry 参数
ZakaryCode Aug 8, 2024
9fd63a7
fix(runner): word spelling
ZakaryCode Aug 8, 2024
e5c3836
feat(runner): add modifyEntryFile func
ZakaryCode Aug 8, 2024
b473380
Merge remote-tracking branch 'origin/main' into feat/harmony
ZakaryCode Aug 11, 2024
df9bd5b
chore(release): publish 4.0.0-beta.134 --tag=beta
ZakaryCode Aug 11, 2024
f12e134
fix: update runner hooks
ZakaryCode Aug 12, 2024
5ff77a8
chore(release): publish 4.0.0-beta.135 --tag=beta
ZakaryCode Aug 12, 2024
ebc82ee
fix(harmony): 对齐 page 各生命周期中使用的对象实例
ZakaryCode Aug 20, 2024
e065b0c
chore(release): publish 4.0.0-beta.136 --tag=beta
ZakaryCode Aug 20, 2024
72d764d
fix(harmony): 对齐 custom 路由判断
ZakaryCode Aug 21, 2024
78a3f5b
chore(release): publish 4.0.0-beta.137 --tag=beta
ZakaryCode Aug 21, 2024
7607b10
fix(runner): for wins path
ZakaryCode Aug 28, 2024
cfbcea7
chore(release): publish 4.0.0-beta.138 --tag=beta
ZakaryCode Aug 28, 2024
0316d8c
Merge branch 'main' into feat/merge-harmony
ZEJIA-LIU Oct 25, 2024
704d1fb
chore: 升级 pnpm 版本
ZEJIA-LIU Oct 25, 2024
e1ba95b
feat(vite): 修复 wins 路径问题
ZakaryCode Oct 25, 2024
188e5e2
chore(release): publish 4.0.0-beta.139 --tag=beta
ZakaryCode Oct 25, 2024
3ede921
Merge branch 'feat/harmony' into feat/merge-harmony
ZEJIA-LIU Oct 25, 2024
605bcb8
Merge branch 'main' into feat/merge-harmony
ZEJIA-LIU Oct 25, 2024
5b55f39
test: update snapshoot
ZEJIA-LIU Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-rust-binding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
version: 9
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
version: 9
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
version: 9
- name: Setup Node 18
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-components-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: install
uses: pnpm/[email protected]
with:
version: 8
version: 9
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-helper/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ export function readPageConfig(configPath: string) {
}

interface IReadConfigOptions {
defineConstants?: Record<string, any>
alias?: Record<string, any>
defineConstants?: Record<string, any>
}

export function readConfig<T extends IReadConfigOptions> (configPath: string, options: T = {} as T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function getAttributes (node: TaroScrollViewElement): ScrollViewAttrs {

function getScrollable (node: TaroScrollViewElement) {
const _attrs = node._attrs
if (node?.hmStyle?.overflow === "scroll" || node?.hmStyle?.overflow === "auto") {
return ScrollDirection.Vertical
}
if (_attrs.scrollX) {
return ScrollDirection.Horizontal
} else if (_attrs.scrollY) {
Expand All @@ -47,11 +50,11 @@ function getScrollable (node: TaroScrollViewElement) {

function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', xOffset?: number, yOffset?: number) {
if (!node || !node.scroller) return

const currentOffset = node.scroller.currentOffset() as ScrollViewCurrentOffset

if (!currentOffset) return

const currentXOffset = currentOffset.xOffset
const currentYOffset = currentOffset.yOffset
const value: ScrollViewEvent = {
Expand Down
5 changes: 5 additions & 0 deletions packages/taro-platform-harmony/src/runtime-ets/dom/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ export class TaroNode extends TaroDataSourceElement {
this.childNodes.push(child)
this.notifyDataAdd(this.childNodes.length - 1)

if (this.nodeName === 'TEXT') {
// 修复beta2版本文字从undefined -> 有值时的 不更新问题
this.updateComponent()
}

// @ts-ignore
child.toggleLayer?.(true)

Expand Down
5 changes: 4 additions & 1 deletion packages/taro-vite-runner/src/harmony/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type { RollupInjectOptions } from '@rollup/plugin-inject'
import type { ViteHarmonyCompilerContext } from '@tarojs/taro/types/compile/viteCompilerContext'
import type { InputPluginOption, OutputOptions } from 'rollup'
import type { Plugin, PluginOption } from 'vite'
import type { TaroHarmonyPageMeta } from './template/page'

export default function (viteCompilerContext: ViteHarmonyCompilerContext): PluginOption {
const { taroConfig, cwd: appPath } = viteCompilerContext
Expand Down Expand Up @@ -200,7 +201,9 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
name = name.replace(/[\\/]+/g, '/')

const appId = viteCompilerContext.app.config.appId || 'app'
const isTaroComp = appId === name || viteCompilerContext.pages.some(page => page.name === name) || viteCompilerContext.components?.some(comp => comp.name === name)
const isTaroComp = appId === name ||
viteCompilerContext.pages.some((page: TaroHarmonyPageMeta) => [page.name, page.originName].includes(name)) ||
viteCompilerContext.components?.some((comp: TaroHarmonyPageMeta) => [comp.name, comp.originName].includes(name))
// 如果同时存在app.ets和app.js,因为鸿蒙IDE编译会把app.ets编译成app.ts,会跟app.js冲突,识别都是/app,导致app.js被app.ts覆盖了,所以需要名字
const suffix = isTaroComp ? virtualModulePrefixREG.test(chunkInfo.facadeModuleId || '') ? TARO_COMP_SUFFIX : '_comp' : ''
name = stripMultiPlatformExt(`${name}${suffix}`) + taroConfig.fileType.script
Expand Down
14 changes: 9 additions & 5 deletions packages/taro-vite-runner/src/harmony/emit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { componentConfig } from '../utils/component'

import type { ViteHarmonyCompilerContext } from '@tarojs/taro/types/compile/viteCompilerContext'
import type { PluginOption } from 'vite'
import type { TaroHarmonyPageMeta } from './template/page'

export default function (viteCompilerContext: ViteHarmonyCompilerContext): PluginOption {
const { taroConfig } = viteCompilerContext
Expand Down Expand Up @@ -104,18 +105,21 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
const comps = viteCompilerContext.getComponents() || []

const lines: string[] = []
comps.forEach(comp => {
const key = Object.keys(taroConfig.router?.customRoutes || {}).find(e => [comp.name, addLeadingSlash(comp.name)].includes(e))
comps.forEach((comp: TaroHarmonyPageMeta) => {
const key = Object.keys(taroConfig.router?.customRoutes || {}).find(e => {
const name = comp.originName || comp.name
return [name, addLeadingSlash(name)].includes(e)
})

if (key) {
const alias = taroConfig.router?.customRoutes![key]
if (alias instanceof Array) {
alias.forEach(item => lines.push(`export * from './${path.join('src/main', 'ets', item)}'`))
alias.forEach(item => lines.push(`export * from './${path.posix.join('src/main', 'ets', item)}'`))
} else if (typeof alias === 'string') {
lines.push(`export * from './${path.join('src/main', 'ets', alias)}'`)
lines.push(`export * from './${path.posix.join('src/main', 'ets', alias)}'`)
}
} else {
lines.push(`export * from './${path.join('src/main', 'ets', comp.name)}'`)
lines.push(`export * from './${path.posix.join('src/main', 'ets', comp.name)}'`)
}
})
lines.push('')
Expand Down
12 changes: 6 additions & 6 deletions packages/taro-vite-runner/src/harmony/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ export default function (viteCompilerContext: ViteHarmonyCompilerContext): Plugi
pageName = 'index'
}

const page_ = page as TaroHarmonyPageMeta
page_.id = id
page_.originName = page.name
page_.name = pageName

this.emitFile({
type: 'prebuilt-chunk',
fileName: viteCompilerContext.getTargetFilePath(pageName, '.ets'),
code: parse.parse(path.resolve(appRoot, pageName), {
...page,
originName: page.name,
name: pageName,
id,
} as TaroHarmonyPageMeta, name, this.resolve),
code: parse.parse(path.resolve(appRoot, pageName), page_, name, this.resolve),
exports: ['default'],
})
})
Expand Down
13 changes: 8 additions & 5 deletions packages/taro-vite-runner/src/harmony/template/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from 'node:path'

import { isFunction } from '@tarojs/shared'

import { escapePath, resolveAbsoluteRequire } from '../../utils'
import { TARO_COMP_SUFFIX } from '../entry'
import { TARO_TABBAR_PAGE_PATH } from '../page'
Expand Down Expand Up @@ -116,8 +118,8 @@ export default class Parser extends BaseParser {
}
`

if (typeof modifyInstantiate === 'function') {
instantiateApp = modifyInstantiate(instantiateApp, 'app')
if (isFunction(modifyInstantiate)) {
instantiateApp = modifyInstantiate.call(this, instantiateApp, 'app')
}

return instantiateApp
Expand Down Expand Up @@ -156,10 +158,9 @@ export default class Parser extends BaseParser {
}

parseEntry (rawId: string, config = {}) {
const { creator, creatorLocation, frameworkArgs, importFrameworkStatement } = this.loaderMeta
const { creator, creatorLocation, frameworkArgs, importFrameworkStatement, modifyEntryFile } = this.loaderMeta
const createApp = `${creator}(component, ${frameworkArgs})`

return this.transArr2Str([
const rawCode = this.transArr2Str([
'import { initPxTransform } from "@tarojs/taro"',
`import { ${creator} } from "${creatorLocation}"`,
`import component from "${escapePath(rawId)}"`,
Expand All @@ -168,5 +169,7 @@ export default class Parser extends BaseParser {
this.getInitPxTransform(),
`export default () => ${createApp}`,
])

return isFunction(modifyEntryFile) ? modifyEntryFile.call(this, 'app', rawId, rawCode, config) : rawCode
}
}
40 changes: 21 additions & 19 deletions packages/taro-vite-runner/src/harmony/template/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface TaroHarmonyPageMeta extends VitePageMeta {

modifyPageAppear?: (this: Parser, appearStr: string, page: TaroHarmonyPageMeta | TaroHarmonyPageMeta[]) => string

modifyPageDisAppear?: (this: Parser, appearStr: string, page: TaroHarmonyPageMeta | TaroHarmonyPageMeta[]) => string
modifyPageDisappear?: (this: Parser, appearStr: string, page: TaroHarmonyPageMeta | TaroHarmonyPageMeta[]) => string

modifyPageBuild?: (this: Parser, buildStr: string, page: TaroHarmonyPageMeta | TaroHarmonyPageMeta[]) => string

Expand Down Expand Up @@ -705,7 +705,7 @@ for (let i = 0; i < taskQueen.length; i++) {

let instantiatePage = this.transArr2Str(structCodeArray)
if (isFunction(modifyInstantiate)) {
instantiatePage = modifyInstantiate(instantiatePage, 'page')
instantiatePage = modifyInstantiate.call(this, instantiatePage, 'page', page)
}

return instantiatePage
Expand Down Expand Up @@ -944,20 +944,20 @@ ${this.transArr2Str(pageStr.split('\n'), 6)}
}

generatePageAboutToDisAppear (page: TaroHarmonyPageMeta | TaroHarmonyPageMeta[]) {
const modifyPageDisAppear = page instanceof Array ? page[0].modifyPageDisAppear : page.modifyPageDisAppear
const modifyPageDisappear = page instanceof Array ? page[0].modifyPageDisappear : page.modifyPageDisappear

// 生成 aboutToDisAppear 函数内容
let disAppearStr = this.transArr2Str([
// 生成 aboutToDisappear 函数内容
let disappearStr = this.transArr2Str([
this.isTabbarPage ? `this.pageList?.forEach(item => {
callFn(item?.onUnload, this)
})
this.removeTabBarEvent()` : 'callFn(this.page?.onUnload, this)'])

if (isFunction(modifyPageDisAppear)) {
disAppearStr = modifyPageDisAppear.call(this, disAppearStr, page)
if (isFunction(modifyPageDisappear)) {
disappearStr = modifyPageDisappear.call(this, disappearStr, page)
}

return disAppearStr
return disappearStr
}

generatePageShown () {
Expand Down Expand Up @@ -1078,21 +1078,21 @@ this.removeTabBarEvent()` : 'callFn(this.page?.onUnload, this)'])
}

parseEntry (rawId: string, page: TaroHarmonyPageMeta) {
const { creatorLocation, importFrameworkStatement } = this.loaderMeta
const { creatorLocation, frameworkArgs, importFrameworkStatement, modifyEntryFile } = this.loaderMeta
const entryOption = page instanceof Array ? page[0].entryOption : page.entryOption
const isBlended = this.buildConfig.blended || this.buildConfig.isBuildNativeComp
let createFn = isBlended ? 'createNativePageConfig' : 'createPageConfig'
// FIXME: pure 参数应该使用 page.entryOption 替代
const createFn = this.isPure
? 'createNativeComponentConfig'
: isBlended
? 'createNativePageConfig' : 'createPageConfig'
const pageName = entryOption?.routeName || page.name
const nativeCreatePage = `createNativePageConfig(component, '${pageName}', React, ReactDOM, config)`
let createPageOrComponent = isBlended ? nativeCreatePage : `createPageConfig(component, '${pageName}', config)`
const createPageOrComponent = `${createFn}(component, ${this.isPure
? `${frameworkArgs}`
: isBlended
? `'${pageName}', ${frameworkArgs}` : `'${pageName}', config`})`

// 如果是pure,说明不是一个页面,而是一个组件,这个时候修改import和createPage
if (this.isPure) {
createFn = 'createNativeComponentConfig'
createPageOrComponent = `createNativeComponentConfig(component, React, ReactDOM, config)`
}

return this.transArr2Str([
const rawCode = this.transArr2Str([
`import { ${createFn} } from '${creatorLocation}'`,
`import component from "${escapePath(rawId)}"`,
isBlended ? 'import { initPxTransform } from "@tarojs/taro"' : null,
Expand All @@ -1103,5 +1103,7 @@ this.removeTabBarEvent()` : 'callFn(this.page?.onUnload, this)'])
page?.config.enableShareAppMessage ? 'component.enableShareAppMessage = true' : null,
`export default () => ${createPageOrComponent}`,
])

return isFunction(modifyEntryFile) ? modifyEntryFile.call(this, 'page', rawId, rawCode, page) : rawCode
}
}
3 changes: 2 additions & 1 deletion packages/taro-vite-runner/src/harmony/template/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export default class RenderParser extends BaseParser {
if (meta.isPackage) {
importList.push(`import ${meta.name} from '${meta.scriptPath}'`)
} else {
const nativePath = path.relative(this.context.sourceDir, meta.scriptPath).replace(/\.ets$/, '')
const nativePath = path.posix.relative(this.context.sourceDir, meta.scriptPath)
.replace(/[\\/]+/g, '/').replace(/\.ets$/, '')
importList.push(`import ${meta.name} from './${nativePath}'`)
}
})
Expand Down
Loading
Loading