Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

默认模版使用 less css module 报错 #14991

Open
yangfanzn opened this issue Dec 15, 2023 · 3 comments
Open

默认模版使用 less css module 报错 #14991

yangfanzn opened this issue Dec 15, 2023 · 3 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@yangfanzn
Copy link

相关平台

微信小程序

复现仓库

https://gitee.com/yangfanzn/taroerror.git
小程序基础库: 3.2.4
使用框架: React

复现步骤

yarn && yarn dev:weapp

期望结果

正常编译, 不报错

实际结果

⚠️ Warnings:

at HarmonyImportSpecifierDependency.getLinkingErrors (/Users/yangfanzn/Documents/code/tarotest/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:160:8)

ModuleDependencyWarning: export 'default' (imported as 'style') was not found in './index.less' (module has no exports)

→ Watching... [12/15/2023, 6:15:01 PM]

环境信息

👽 Taro v3.6.20


  Taro CLI 3.6.20 environment info:
    System:
      OS: macOS 11.7.4
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.20.0 - ~/.nvm/versions/node/v14.20.0/bin/node
      Yarn: 1.22.10 - ~/.nvm/versions/node/v14.20.0/bin/yarn
      npm: 6.14.17 - ~/.nvm/versions/node/v14.20.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.20 => 3.6.20 
      @tarojs/components: 3.6.20 => 3.6.20 
      @tarojs/helper: 3.6.20 => 3.6.20 
      @tarojs/plugin-framework-react: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-alipay: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-h5: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-jd: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-qq: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-swan: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-tt: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-weapp: 3.6.20 => 3.6.20 
      @tarojs/runtime: 3.6.20 => 3.6.20 
      @tarojs/shared: 3.6.20 => 3.6.20 
      @tarojs/taro: 3.6.20 => 3.6.20 
      @tarojs/taro-loader: 3.6.20 => 3.6.20 
      @tarojs/webpack5-runner: 3.6.20 => 3.6.20 
      babel-preset-taro: 3.6.20 => 3.6.20 
      eslint-config-taro: 3.6.20 => 3.6.20 


补充信息

拉取的 preact less typescript webpack5 默认模版, 将 css module 改成了 true
完全按照官方文档的例子写的 https://taro-docs.jd.com/docs/css-modules

@TheKonka
Copy link
Member

你的css文件名要 以 .module.less 结尾

@yangfanzn
Copy link
Author

你的css文件名要 以 .module.less 结尾

谢谢啊, 我刚刚试了下, 加了 .module.less 确实可以了
有没有办法不加 .module 也可以支持 css module 呢?
@TheKonka

@TheKonka
Copy link
Member

@ZakaryCode ZakaryCode added V-3 Version - 3.x T-weapp Target - 编译到微信小程序 F-react Framework - React labels Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Status: Todo
Development

No branches or pull requests

3 participants