Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
Tangjj1996 opened this issue Apr 15, 2024 · 0 comments
Open

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

Tangjj1996 opened this issue Apr 15, 2024 · 0 comments

Comments

@Tangjj1996
Copy link

问题描述

@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'
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant