jd-opensource/taro-ui

Can't find stylesheet to import.

Closed this issue · 1 comments

Taro UI 版本信息

v3.3.0

问题描述

项目无法编译

复现步骤

  1. clone https://github.com/ianzone/taro-template/tree/ui-scss-bug
  2. npm install
  3. npm run dev:weapp

复现代码

https://github.com/ianzone/taro-template/blob/ui-scss-bug/src/app.scss

报错信息

$ taro build --type weapp --watch
👽 Taro v4.0.6

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
Tips:

  1. 预览模式生成的文件较大,设置 NODE_ENV 为 production 可以开启压缩。
    Example:
    $ set NODE_ENV=production && taro build --type weapp --watch

vite v5.4.8 building for production...

watching for file changes...

build started...
✓ 61 modules transformed.
[vite:css] [sass] Can't find stylesheet to import.

1 │ @import "~taro-ui/dist/style/index.scss";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src\app.scss 1:9 root stylesheet
file: D:/templates/taro-template/src/app.scss

Error: Can't find stylesheet to import.

1 │ @import "~taro-ui/dist/style/index.scss";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src\app.scss 1:9 root stylesheet

系统信息

Taro CLI 4.0.5 environment info:
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 20.17.0 - C:\Program Files\nodejs\node.EXE
npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
npmPackages:
@tarojs/cli: ^4.0.6 => 4.0.6
@tarojs/components: ^4.0.6 => 4.0.6
@tarojs/helper: ^4.0.6 => 4.0.6
@tarojs/plugin-framework-react: ^4.0.6 => 4.0.6
@tarojs/plugin-platform-alipay: ^4.0.6 => 4.0.6
@tarojs/plugin-platform-h5: ^4.0.6 => 4.0.6
@tarojs/plugin-platform-weapp: ^4.0.6 => 4.0.6
@tarojs/react: ^4.0.6 => 4.0.6
@tarojs/runtime: ^4.0.6 => 4.0.6
@tarojs/shared: ^4.0.6 => 4.0.6
@tarojs/taro: ^4.0.6 => 4.0.6
@tarojs/vite-runner: ^4.0.6 => 4.0.6
babel-preset-taro: ^4.0.6 => 4.0.6
react: ^18.3.1 => 18.3.1
taro-ui: ^3.3.0 => 3.3.0

补充信息

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~