taro3 命令dev:h5报错且编码页面无更新



  • h5配置:

    h5: {
        publicPath: '/',
        staticDirectory: 'static',
        devServer: {
          port: 8444,      // 端口号
          host:'localhost',
          open: false,    //配置自动启动浏览器
          proxy:{
                  '/open/':{
                    target:"http://dev.xxx.com",
                    changeOrigin:true,
                    secure:false
                  }
                }
        },
        postcss: {
          autoprefixer: {
            enable: true,
            config: {
            }
          },
          cssModules: {
            enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
            config: {
              namingPattern: 'module', // 转换模式,取值为 global/module
              generateScopedName: '[name]__[local]___[hash:base64:5]'
            }
          }
        }
      }
    

    终端运行结果:

    > qkth5TaroV@1.0.0 build:h5 /Users/chenmeiyuan/Documents/quantong/qkth5TaroV
    > taro build --type h5 "--watch"
    
    👽 Taro v3.0.0-rc.6
    
    
    ⠋ Compiling...ℹ 「wds」: Project is running at http://localhost:8444/
    ℹ 「wds」: webpack output is served from /
    ℹ 「wds」: Content not from webpack is served from /Users/chenmeiyuan/Documents/quantong/qkth5TaroV/dist
    ℹ 「wds」: 404s will fallback to /index.html
    
    ℹ️  Listening at http://localhost:8444/
    
    监听文件修改中...
    
    🙅   Failed to compile.
    
    ./src/pages/index/index.vue
    Module Error (from ./node_modules/@tarojs/webpack-runner/node_modules/vue-loader/lib/index.js):
    
    
    Vue packages version mismatch:
    
    - vue@3.0.0-beta.18 (/Users/chenmeiyuan/Documents/quantong/qkth5TaroV/node_modules/vue/index.js)
    - vue-template-compiler@2.6.11 (/Users/chenmeiyuan/Documents/quantong/qkth5TaroV/node_modules/vue-template-compiler/package.json)
    
    This may cause things to work incorrectly. Make sure to use the same version for both.
    If you are using vue-loader@>=10.0, simply update vue-template-compiler.
    If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
    
    ^C
    chenmeiyuandeMacBook-Air:qkth5TaroV chenmeiyuan$ taro -version
    👽 Taro v3.0.0-rc.6
    
    3.0.0-rc.6
    
    


  • 用 3.0.2 版本重新创建个就好了。是在微信群里知道的
    命令 yarn global add @tarojs/cli@3.0.2
    然后创建项目


登录后回复