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

4.0.8 vite+react 支付宝小程序开发模式无法启动或打包 #16991

Open
yamlling opened this issue Dec 5, 2024 · 2 comments
Open

4.0.8 vite+react 支付宝小程序开发模式无法启动或打包 #16991

yamlling opened this issue Dec 5, 2024 · 2 comments
Labels
F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-4 Version - 4.x

Comments

@yamlling
Copy link

yamlling commented Dec 5, 2024

相关平台

支付宝小程序

小程序基础库: 最新版本
使用框架: React

复现步骤

npm run dev:alipay
npm run build:alipay

报错提示如下
vite v4.5.5 building for production...

watching for file changes...

build started...
✓ 388 modules transformed.
C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules@tarojs\vite-runner\dist\mini\emit.js:188
if (chunk.type === 'asset') {
^

TypeError: Cannot read properties of undefined (reading 'type')
at Object.set (C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules@tarojs\vite-runner\src\mini\emit.ts:191:25)
at Object.fn (C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules@tarojs\plugin-platform-alipay\src\program.ts:121:32)
at Kernel. (C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules@tarojs\service\src\Kernel.ts:307:34)
at Generator.next ()
at C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules@tarojs\service\dist\Kernel.js:8:71
at new Promise ()
at __awaiter (C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules@tarojs\service\dist\Kernel.js:4:12)
at C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules@tarojs\service\src\Kernel.ts:306:24
at _next0 (eval at create (C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules\tapable\lib\HookCodeFactory.js:75:10), :17:17)
at eval (eval at create (C:\Users\Notx200\Desktop\饰品商城-H5商城\node_modules\tapable\lib\HookCodeFactory.js:75:10), :41:1)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.10.0
error Command failed with exit code 1.

期望结果

能正常启动或打包支付宝小程序项目

实际结果

无法正常启动或打包

环境信息

👽 Taro v4.0.8


  Taro CLI 4.0.8 environment info:
    System:
      OS: Windows 11 10.0.26100
    Binaries:
      Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
      npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 4.0.8 => 4.0.8
      @tarojs/components: 4.0.8 => 4.0.8
      @tarojs/helper: 4.0.8 => 4.0.8
      @tarojs/plugin-framework-react: 4.0.8 => 4.0.8
      @tarojs/plugin-html: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-alipay: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-h5: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-harmony-hybrid: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-jd: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-qq: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-swan: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-tt: 4.0.8 => 4.0.8
      @tarojs/plugin-platform-weapp: 4.0.8 => 4.0.8
      @tarojs/react: 4.0.8 => 4.0.8
      @tarojs/runtime: 4.0.8 => 4.0.8
      @tarojs/shared: 4.0.8 => 4.0.8
      @tarojs/taro: 4.0.8 => 4.0.8
      @tarojs/vite-runner: 4.0.8 => 4.0.8
      babel-preset-taro: 4.0.8 => 4.0.8
      eslint-config-taro: 4.0.8 => 4.0.8
      react: ^18.0.0 => 18.3.1
      taro-ui: ^3.3.0 => 3.3.0

//package.json依赖内容如下
{
"name": "alipay",
"version": "1.0.0",
"private": true,
"description": "react",
"templateInfo": {
"name": "default",
"typescript": true,
"css": "Sass",
"framework": "React"
},
"scripts": {
"postinstall": "weapp-tw patch",
"build:debug": "node --inspect-brk ./node_modules/.bin/taro build --type h5",
"build:weapp": "taro build --type weapp",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
"build:tt": "taro build --type tt",
"build:h5": "taro build --type h5",
"build:rn": "taro build --type rn",
"build:qq": "taro build --type qq",
"build:jd": "taro build --type jd",
"build:harmony-hybrid": "taro build --type harmony-hybrid",
"dev:weapp": "npm run build:weapp -- --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch",
"dev:h5": "npm run build:h5 -- --watch",
"dev:rn": "npm run build:rn -- --watch",
"dev:qq": "npm run build:qq -- --watch",
"dev:jd": "npm run build:jd -- --watch",
"dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch"
},
"browserslist": [
"defaults and fully supports es6-module",
"maintained node versions"
],
"author": "",
"dependencies": {
"@babel/runtime": "^7.24.4",
"@nutui/nutui-react-taro": "^2.6.16",
"@tarojs/components": "4.0.8",
"@tarojs/helper": "4.0.8",
"@tarojs/plugin-framework-react": "4.0.8",
"@tarojs/plugin-html": "4.0.8",
"@tarojs/plugin-platform-alipay": "4.0.8",
"@tarojs/plugin-platform-h5": "4.0.8",
"@tarojs/plugin-platform-harmony-hybrid": "4.0.8",
"@tarojs/plugin-platform-jd": "4.0.8",
"@tarojs/plugin-platform-qq": "4.0.8",
"@tarojs/plugin-platform-swan": "4.0.8",
"@tarojs/plugin-platform-tt": "4.0.8",
"@tarojs/plugin-platform-weapp": "4.0.8",
"@tarojs/react": "4.0.8",
"@tarojs/runtime": "4.0.8",
"@tarojs/shared": "4.0.8",
"@tarojs/taro": "4.0.8",
"autoprefixer": "^10.4.20",
"axios": "0.27.2",
"axios-taro4-adapter": "^0.0.1",
"babel-plugin-import": "^1.13.8",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"qs": "^6.13.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"taro-ui": "^3.3.0"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/plugin-proposal-class-properties": "7.14.5",
"@babel/preset-react": "^7.24.1",
"@tarojs/cli": "4.0.8",
"@tarojs/vite-runner": "4.0.8",
"@types/react": "^18.0.0",
"@vitejs/plugin-react": "^4.3.0",
"babel-preset-taro": "4.0.8",
"eslint": "^8.57.0",
"eslint-config-taro": "4.0.8",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.4.0",
"postcss": "^8.4.38",
"react-refresh": "^0.14.0",
"sass": "1.77.6",
"stylelint": "^16.4.0",
"tailwindcss": "^3.4.10",
"terser": "^5.30.4",
"typescript": "^5.4.5",
"vite": "^4.2.0",
"weapp-tailwindcss": "^3.5.0"
}
}

@yamlling
Copy link
Author

yamlling commented Dec 5, 2024

使用官方的初始化模板就可以复现该问题

@TheKonka TheKonka added F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-4 Version - 4.x labels Dec 6, 2024
@mu-yu
Copy link

mu-yu commented Dec 6, 2024

vue 也存在同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-4 Version - 4.x
Projects
None yet
Development

No branches or pull requests

3 participants