taro 3.6.29以后H5依赖预编译失败

l7mqbcuq  于 4个月前  发布在  其他
关注(0)|答案(4)|浏览(43)

相关平台

H5

浏览器版本: Chrome 126
使用框架: React

复现步骤

  • 初始化项目(>=3.6.29) taro init demo-1
  • npm run dev:h5

期望结果

依赖预编译成功

实际结果

依赖预编译失败,已经为您跳过预编译步骤,但是编译速度可能会受到影响
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.

  • configuration.output.environment has an unknown property 'asyncFunction'. These properties are valid:
    object { arrowFunction?, bigIntLiteral?, const?, destructuring?, dynamicImport?, forOf?, module?, optionalChaining?, templateLiteral? }
    -> The abilities of the environment where the webpack generated code should run.
    at validate (/Users/chenxiaoyun/work/github/test/official-01/node_modules/.pnpm/schema-utils@3.3.0/node_modules/schema-utils/dist/validate.js:191:11)
    at validateSchema (/Users/chenxiaoyun/work/github/test/official-01/node_modules/.pnpm/webpack@ 5.78.0_@swc core@1.3.96/node_modules/webpack/lib/validateSchema.js:78:2)

环境信息

Taro v3.6.33

  Taro CLI 3.6.33 environment info:
    System:
      OS: macOS 14.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
      Yarn: 1.22.22 - ~/.nvm/versions/node/v20.10.0/bin/yarn
      npm: 10.2.4 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.29 => 3.6.29 
      @tarojs/components: 3.6.29 => 3.6.29 
      @tarojs/helper: 3.6.29 => 3.6.29 
      @tarojs/plugin-framework-react: 3.6.29 => 3.6.29 
      @tarojs/plugin-platform-alipay: 3.6.29 => 3.6.29 
      @tarojs/plugin-platform-h5: 3.6.29 => 3.6.29 
      @tarojs/plugin-platform-jd: 3.6.29 => 3.6.29 
      @tarojs/plugin-platform-qq: 3.6.29 => 3.6.29 
      @tarojs/plugin-platform-swan: 3.6.29 => 3.6.29 
      @tarojs/plugin-platform-tt: 3.6.29 => 3.6.29 
      @tarojs/plugin-platform-weapp: 3.6.29 => 3.6.29 
      @tarojs/react: 3.6.29 => 3.6.29 
      @tarojs/runtime: 3.6.29 => 3.6.29 
      @tarojs/shared: 3.6.29 => 3.6.29 
      @tarojs/taro: 3.6.29 => 3.6.29 
      @tarojs/taro-loader: 3.6.29 => 3.6.29 
      @tarojs/webpack5-runner: 3.6.29 => 3.6.29 
      babel-preset-taro: 3.6.29 => 3.6.29 
      eslint-config-taro: 3.6.29 => 3.6.29 
      react: ^18.0.0 => 18.3.1
dohp0rv5

dohp0rv51#

将src/index.html中的 <%= projectName %>改为 <%= htmlWebpackPlugin.options.title %>

h43kikqp

h43kikqp2#

将src/index.html中的 <%= projectName %>改为 <%= htmlWebpackPlugin.options.title %>

不行呢

qncylg1j

qncylg1j3#

开发环境:
在文件./config/dev.ts
添加一行
compiler: { type: "webpack5", prebunde: { enable: false, } },
如:
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {
},
compiler: { type: "webpack5", prebunde: { enable: false, } },
mini: {},
h5: {}
}

o4hqfura

o4hqfura4#

请问你解决了吗,遇到同样的问题
taro v3.6.32
node v16.20.2

相关问题