dcloudio / uni-app

A cross-platform framework using Vue.js
https://uniapp.dcloud.io
Apache License 2.0
40.1k stars 3.63k forks source link

2.0.1-32920211122002之后的版本无法使用<style lang="scss"> #3129

Closed smoothdvd closed 2 years ago

smoothdvd commented 2 years ago

问题描述 2.0.1-32920211122002之后的版本无法使用

  • yarn build:mp-weixin
  • [或者可以直接贴源代码]

    正确编译

    实际结果

     ERROR  Failed to compile with 1 error                                                                     4:00:48 PM
    
     error  in ./src/App.vue?vue&type=style&index=0&lang=scss&
    
    ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
     - options has an unknown property 'additionalData'. These properties are valid:
       object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    
     @ ./src/App.vue?vue&type=style&index=0&lang=scss& 1:0-821 1:837-840 1:842-1660 1:842-1660
     @ ./src/App.vue
     @ ./src/main.ts

    package.json

    {
      "name": "uni-app",
      "version": "0.1.0",
      "private": true,
      "scripts": {
        "serve": "npm run dev:h5",
        "build": "npm run build:h5",
        "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
        "build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
        "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
        "build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
        "build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build",
        "build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build",
        "build:mp-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build",
        "build:mp-lark": "cross-env NODE_ENV=production UNI_PLATFORM=mp-lark vue-cli-service uni-build",
        "build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build",
        "build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build",
        "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
        "build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build",
        "build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build",
        "build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build",
        "build:quickapp-webview-union": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build",
        "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
        "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
        "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
        "dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
        "dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch",
        "dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch",
        "dev:mp-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch",
        "dev:mp-lark": "cross-env NODE_ENV=development UNI_PLATFORM=mp-lark vue-cli-service uni-build --watch",
        "dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch",
        "dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch",
        "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
        "dev:quickapp-native": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch",
        "dev:quickapp-webview": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch",
        "dev:quickapp-webview-huawei": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch",
        "dev:quickapp-webview-union": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build --watch",
        "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js",
        "serve:quickapp-native": "node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js",
        "test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i",
        "test:h5": "cross-env UNI_PLATFORM=h5 jest -i",
        "test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i",
        "test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i",
        "test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i"
      },
      "dependencies": {
        "@dcloudio/uni-app-plus": "^2.0.1-33420211228004",
        "@dcloudio/uni-h5": "^2.0.1-33420211228004",
        "@dcloudio/uni-helper-json": "*",
        "@dcloudio/uni-i18n": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-360": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-alipay": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-baidu": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-kuaishou": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-lark": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-qq": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-toutiao": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-vue": "^2.0.1-33420211228004",
        "@dcloudio/uni-mp-weixin": "^2.0.1-33420211228004",
        "@dcloudio/uni-quickapp-native": "^2.0.1-33420211228004",
        "@dcloudio/uni-quickapp-webview": "^2.0.1-33420211228004",
        "@dcloudio/uni-stat": "^2.0.1-33420211228004",
        "@vue/shared": "^3.0.0",
        "core-js": "^3.6.5",
        "flyio": "^0.6.2",
        "regenerator-runtime": "^0.12.1",
        "vue": "^2.6.11",
        "vue-class-component": "^6.3.2",
        "vue-property-decorator": "^8.0.0",
        "vuex": "^3.2.0"
      },
      "devDependencies": {
        "@babel/plugin-syntax-typescript": "^7.2.0",
        "@babel/runtime": "~7.12.0",
        "@dcloudio/types": "*",
        "@dcloudio/uni-automator": "^2.0.1-33420211228004",
        "@dcloudio/uni-cli-i18n": "^2.0.1-33420211228004",
        "@dcloudio/uni-cli-shared": "^2.0.1-33420211228004",
        "@dcloudio/uni-migration": "^2.0.1-33420211228004",
        "@dcloudio/uni-template-compiler": "^2.0.1-33420211228004",
        "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.1-33420211228004",
        "@dcloudio/vue-cli-plugin-uni": "^2.0.1-33420211228004",
        "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.1-33420211228004",
        "@dcloudio/webpack-uni-mp-loader": "^2.0.1-33420211228004",
        "@dcloudio/webpack-uni-pages-loader": "^2.0.1-33420211228004",
        "@vue/cli-plugin-babel": "~4.5.0",
        "@vue/cli-plugin-typescript": "*",
        "@vue/cli-service": "~4.5.0",
        "babel-plugin-import": "^1.11.0",
        "cross-env": "^7.0.2",
        "jest": "^25.4.0",
        "mini-types": "*",
        "miniprogram-api-typings": "*",
        "postcss-comment": "^2.0.0",
        "sass": "^1.35.1",
        "sass-loader": "^10.1.0",
        "typescript": "^3.0.0",
        "vue-template-compiler": "^2.6.11"
      },
      "browserslist": [
        "Android >= 4.4",
        "ios >= 9"
      ],
      "uni-app": {
        "scripts": {}
      }
    }
    yarn run v1.22.17
    $ node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js
    uni-app v3.3.4
    uni-app cli v2.0.1-33420211228004
    
    Environment Info:
    
      System:
        OS: Linux 5.13 Ubuntu 21.10 21.10 (Impish Indri)
        CPU: (4) x64 Intel(R) Core(TM) i5-2400S CPU @ 2.50GHz
      Binaries:
        Node: 12.22.5 - /tmp/yarn--1640766858027-0.23111058684801145/node
        Yarn: 1.22.17 - /tmp/yarn--1640766858027-0.23111058684801145/yarn
        npm: 8.3.0 - ~/.yarn/bin/npm
      Browsers:
        Chrome: 96.0.4664.110
        Firefox: 95.0.2
      npmPackages:
        @dcloudio/types: * => 2.5.15 
        @dcloudio/uni-app-plus: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-app-plus-nvue:  0.0.1 
        @dcloudio/uni-app-plus-nvue-v8:  0.0.1 
        @dcloudio/uni-automator: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-cli-i18n: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-cli-shared: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-h5: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-helper-json: * => 1.0.13 
        @dcloudio/uni-i18n: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-migration: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-360: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-alipay: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-baidu: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-kuaishou: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-lark: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-qq: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-toutiao: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-vue: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-mp-weixin: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-quickapp-native: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-quickapp-webview: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-stat: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/uni-template-compiler: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/vue-cli-plugin-hbuilderx: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/vue-cli-plugin-uni: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/vue-cli-plugin-uni-optimize: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/webpack-uni-mp-loader: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @dcloudio/webpack-uni-nvue-loader:  0.0.1 
        @dcloudio/webpack-uni-pages-loader: ^2.0.1-33420211228004 => 2.0.1-33420211228004 
        @hap-toolkit/dsl-vue:  0.6.13 
        @vue/babel-helper-vue-jsx-merge-props:  1.2.1 
        @vue/babel-helper-vue-transform-on:  1.0.2 
        @vue/babel-plugin-jsx:  1.1.1 
        @vue/babel-plugin-transform-vue-jsx:  1.2.1 
        @vue/babel-preset-app:  4.5.15 
        @vue/babel-preset-jsx:  1.2.4 
        @vue/babel-sugar-composition-api-inject-h:  1.2.1 
        @vue/babel-sugar-composition-api-render-instance:  1.2.4 
        @vue/babel-sugar-functional-vue:  1.2.2 
        @vue/babel-sugar-inject-h:  1.2.2 
        @vue/babel-sugar-v-model:  1.2.3 
        @vue/babel-sugar-v-on:  1.2.3 
        @vue/cli-overlay:  4.5.15 
        @vue/cli-plugin-babel: ~4.5.0 => 4.5.15 
        @vue/cli-plugin-router:  4.5.15 
        @vue/cli-plugin-typescript: * => 4.5.15 
        @vue/cli-plugin-vuex:  4.5.15 
        @vue/cli-service: ~4.5.0 => 4.5.15 
        @vue/cli-shared-utils:  4.5.15 
        @vue/component-compiler-utils:  3.3.0 (3.3.0)
        @vue/devtools-api:  6.0.0-beta.15 
        @vue/preload-webpack-plugin:  1.1.2 
        @vue/shared: ^3.0.0 => 3.2.26 
        @vue/web-component-wrapper:  1.3.0 
        mpvue-page-factory:  1.0.1 
        mpvue-template-compiler:  1.0.13 
        uni-h5-vue:  2.6.10 
        uni-mp-vue:  2.6.10 
        vue: ^2.6.11 => 2.6.14 
        vue-class-component: ^6.3.2 => 6.3.2 (7.2.6)
        vue-hot-reload-api:  2.3.4 
        vue-loader:  15.9.8 (16.8.3, 15.9.8)
        vue-property-decorator: ^8.0.0 => 8.5.1 
        vue-router:  3.0.1 
        vue-style-loader:  4.1.3 (4.1.3)
        vue-template-compiler: ^2.6.11 => 2.6.14 (2.6.14)
        vue-template-es2015-compiler:  1.9.1 
        vue3:  1.0.0 
        vuex: ^3.2.0 => 3.6.2 (3.6.2)
      npmGlobalPackages:
        @vue/cli: Not Found
    
    Done in 10.63s.
    ihwf commented 2 years ago

    同样的问题

    smoothdvd commented 2 years ago

    看了一下uni-app源码,是因为直接把sass-loader@8.0.2的源码直接放在uni-app/packages/vue-cli-plugin-uni/packages/里了。

    那这样的话,uni-app/packages/vue-cli-plugin-uni/lib/options.js里这段代码还有什么意义?

    https://github.com/dcloudio/uni-app/blob/112745225345a7264e1d5bf9bce76e09e146dfb4/packages/vue-cli-plugin-uni/lib/options.js#L89-L94

    ihwf commented 2 years ago

    暂时将sass-loader降回8.0.2解决

    lauhuawei commented 2 years ago

    暂时将sass-loader降回8.0.2解决

    我降了还是不行

    smoothdvd commented 2 years ago

    @lauhuawei 删掉自己装的试试,这个相当于内置了8.0.2的sass-loader。

    AnaniZhu commented 2 years ago

    同样的问题,官方有解决方案么?

    guyskk commented 2 years ago

    @lauhuawei 删掉自己装的试试,这个相当于内置了8.0.2的sass-loader。

    👍 删掉 package.json 里的 sass-loader,只保留 sass,npm install 之后运行正常了。