jd-opensource / jd-opensource/taro-ui
Cannot find module './style/index.scss'
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
**问题描述**
import UI 组件出现 Cannot find module './style/index.scss'错误。
**复现步骤**
```js
import React, { Component } from "react";
import { connect } from "react-redux";
import { View, Button, Text } from "@tarojs/components";
import { AtButton } from "taro-ui";
...
render() {
return (
按钮文案
);
}
```
**期望行为**
显示,不应该报错。
**报错信息**
VM111:1 MiniProgramError
Cannot find module './style/index.scss'
Error: Cannot find module './style/index.scss'
at webpackMissingModule (http://127.0.0.1:51933/appservice/pages/index/index.js:13795:45)
at Module../node_modules/taro-ui/dist/weapp/index.ts (http://127.0.0.1:51933/appservice/pages/index/index.js:13795:138)
at __webpack_require__ (http://127.0.0.1:51933/appservice/runtime.js:80:30)
at Object../node_modules/taro-ui/dist/index.js (http://127.0.0.1:51933/appservice/pages/index/index.js:3433:20)
at __webpack_require__ (http://127.0.0.1:51933/appservice/runtime.js:80:30)
at Object../node_modules/babel-loader/lib/index.js!./src/pages/index/index.tsx (http://127.0.0.1:51933/appservice/pages/index/index.js:61:65)
at __webpack_require__ (http://127.0.0.1:51933/appservice/runtime.js:80:30)
at Module../src/pages/index/index.tsx (http://127.0.0.1:51933/appservice/pages/index/index.js:14114:107)
at __webpack_require__ (http://127.0.0.1:51933/appservice/runtime.js:80:30)
at checkDeferredModules (http://127.0.0.1:51933/appservice/runtime.js:46:23)
**系统信息**
Taro CLI 3.0.15 environment info:
System:
OS: macOS 10.14.6
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm
npmPackages:
@tarojs/components: 3.0.15 => 3.0.15
@tarojs/mini-runner: 3.0.15 => 3.0.15
@tarojs/react: 3.0.15 => 3.0.15
@tarojs/runtime: 3.0.15 => 3.0.15
@tarojs/taro: 3.0.15 => 3.0.15
@tarojs/webpack-runner: 3.0.15 => 3.0.15
babel-preset-taro: 3.0.15 => 3.0.15
eslint-config-taro: 3.0.15 => 3.0.15
react: ^16.10.0 => 16.14.0
taro-ui: ^2.3.4 => 2.3.4
**补充信息**
/taro-ui/dist/weapp/index.ts里import的scss路径似乎有错:
import './style/index.scss'
import './style/themes/red.scss'
import './style/themes/purple.scss'
正确的可能应该是:
import '../style/index.scss'
import '../style/themes/red.scss'
import '../style/themes/purple.scss'
Contributor guide
Assessment
This issue has not been assessed yet.