taro
taro copied to clipboard
@tarojs/plugin-platform-h5 无法正常编译
相关平台
H5
浏览器版本: None 使用框架: React
复现步骤
经过测试,在 Node 16、17、18、19、20 均无法正常执行 prebuild 脚本,以下是执行此脚本的日志。
pnpm build
> @tarojs/[email protected] prebuild /Users/kooboo-hectorchong/Project/taro/packages/taro-platform-h5
> run-s clean generate:desc
> @tarojs/[email protected] clean /Users/kooboo-hectorchong/Project/taro/packages/taro-platform-h5
> rimraf dist
> @tarojs/[email protected] generate:desc /Users/kooboo-hectorchong/Project/taro/packages/taro-platform-h5
> pnpm run tsx --files ./build/definition-json
> @tarojs/[email protected] tsx /Users/kooboo-hectorchong/Project/taro/packages/taro-platform-h5
> ts-node --skipIgnore "--files" "./build/definition-json"
(node:43269) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/kooboo-hectorchong/Project/taro/packages/taro-platform-h5/typescript:1
Script started on Thu Feb 8 17:37:45 2024
^^^^^^^
SyntaxError: Unexpected identifier
期望结果
正常编译。
实际结果
编译失败。
环境信息
Taro CLI 3.6.20 environment info:
System:
OS: macOS 14.0
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.5.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.4 - /opt/homebrew/bin/npm
npmPackages:
@tarojs/cli: 3.6.20 => 3.6.20
@tarojs/components: 3.6.20 => 3.6.20
@tarojs/helper: 3.6.20 => 3.6.20
@tarojs/plugin-framework-react: 3.6.20 => 3.6.20
@tarojs/plugin-platform-alipay: 3.6.20 => 3.6.20
@tarojs/plugin-platform-h5: 3.6.20 => 3.6.20
@tarojs/plugin-platform-jd: 3.6.20 => 3.6.20
@tarojs/plugin-platform-qq: 3.6.20 => 3.6.20
@tarojs/plugin-platform-swan: 3.6.20 => 3.6.20
@tarojs/plugin-platform-tt: 3.6.20 => 3.6.20
@tarojs/plugin-platform-weapp: 3.6.20 => 3.6.20
@tarojs/react: 3.6.20 => 3.6.20
@tarojs/runtime: 3.6.20 => 3.6.20
@tarojs/shared: 3.6.20 => 3.6.20
@tarojs/taro: 3.6.20 => 3.6.20
@tarojs/taro-loader: 3.6.20 => 3.6.20
@tarojs/webpack5-runner: 3.6.20 => 3.6.20
babel-preset-taro: 3.6.20 => 3.6.20
eslint-config-taro: 3.6.20 => 3.6.20
react: ^18.0.0 => 18.0.0
补充信息
ts-node 似乎无法执行此脚本,可改用 tsx 或设置此包为 "type": "module"