Skip to content

@tarojs/test-utils-shared 依赖错误 #40

@Tangjj1996

Description

@Tangjj1996

问题描述

@tarojs/test-utils-shared 包的 package.json

{
  "name": "@tarojs/test-utils-shared",
  "version": "0.1.1",
  "main": "dist/index.js",
  "type": "module",
  "license": "MIT",
  "scripts": {
    "dev": "tsc -w",
    "build": "tsc"
  },
  "types": "dist",
  "typings": "dist/index.d.ts",
  "publishConfig": {
    "access": "public"
  },
  "dependencies": {
    "@babel/runtime": "^7.21.5",
    "babel-jest": "^29.5.0",
    "pretty-format": "^29.5.0"
  },
  "devDependencies": {
    "@tarojs/runtime": "^3.6.0",
    "@tarojs/router": "^3.6.0",
    "@tarojs/taro": "^3.6.0",
    "@tarojs/taro-h5": "^3.6.0",
    "@babel/core": "^7.8.0"
  }
}

test-utils-shared/src/lifecycle.ts 用到了 devDependencies 的依赖

import type { AppInstance, PageInstance } from '@tarojs/runtime'
import type { PageResizeObject, PageScrollObject, ShareAppMessageObject, TabItemTapObject } from '@tarojs/taro'
import stacks from '@tarojs/router/dist/router/stack'
...

期望结果

依赖引用和声明统一,避免执行报错

  Cannot find module '@tarojs/router/dist/router/stack' from 'node_modules/@tarojs/test-utils-shared/dist/lifecycle.js'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions