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

v2.2.2-->h5 编译 开启 cssModules 报 options has an unknown property 'localIdentName' #6191

Closed
azhaorz opened this issue Apr 30, 2020 · 10 comments
Assignees

Comments

@azhaorz
Copy link

azhaorz commented Apr 30, 2020

问题描述

v2.2.2 --> h5 编译 开启 cssModules 报 options has an unknown property 'localIdentName'

复现步骤

// ... cssModules: { enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true config: { namingPattern: 'global', // 转换模式,取值为 global/module generateScopedName: '[name]__[local]___[hash:base64:5]' } } // ...

期望行为

编译通过

报错信息

`
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.

  • options has an unknown property 'localIdentName'. These properties are valid:
    object { url?, import?, modules?, sourceMap?, importLoaders?, localsConvention?, onlyLocals?, esModule? }
    `

系统信息

`
👽 Taro v2.2.2

Taro CLI 2.2.2 environment info:
System:
OS: macOS 10.15.4
Shell: 5.7.1 - /usr/local/bin/zsh
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.19.1 - ~/.nvm/versions/node/v10.16.0/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v10.16.0/bin/npm
npmPackages:
@tarojs/async-await: 2.2.2 => 2.2.2
@tarojs/components: 2.2.2 => 2.2.2
@tarojs/components-qa: 2.2.2 => 2.2.2
@tarojs/mini-runner: 2.2.2 => 2.2.2
@tarojs/redux: 2.2.2 => 2.2.2
@tarojs/redux-h5: 2.2.2 => 2.2.2
@tarojs/router: 2.2.2 => 2.2.2
@tarojs/taro: 2.2.2 => 2.2.2
@tarojs/taro-alipay: 2.2.2 => 2.2.2
@tarojs/taro-h5: ^2.2.2 => 2.2.2
@tarojs/taro-qq: 2.2.2 => 2.2.2
@tarojs/taro-quickapp: 2.2.2 => 2.2.2
@tarojs/taro-rn: 2.2.2 => 2.2.2
@tarojs/taro-swan: 2.2.2 => 2.2.2
@tarojs/taro-tt: 2.2.2 => 2.2.2
@tarojs/taro-weapp: 2.2.2 => 2.2.2
@tarojs/webpack-runner: 2.2.2 => 2.2.2
eslint-config-taro: 2.2.2 => 2.2.2
eslint-plugin-taro: 2.2.2 => 2.2.2
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6
stylelint-config-taro-rn: 2.2.2 => 2.2.2
stylelint-taro-rn: 2.2.2 => 2.2.2
npmGlobalPackages:
typescript: 3.7.4
`

@taro-bot
Copy link

taro-bot bot commented Apr 30, 2020

CC @Littly

@taro-bot
Copy link

taro-bot bot commented Apr 30, 2020

欢迎提交 Issue~

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

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

Good luck and happy coding~

@luckyadam
Copy link
Member

没有复现,麻烦检查下 cli 与项目依赖版本是否一致

@divcss3
Copy link

divcss3 commented May 6, 2020

同样H5中有这个问题,v2.1.5则正常
@luckyadam

👽 Taro v2.2.3

Taro CLI 2.2.3 environment info:
System:
OS: macOS 10.14.6
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.16.1 - /usr/local/bin/node
npm: 6.13.4 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 2.2.3 => 2.2.3
@tarojs/components: 2.2.3 => 2.2.3
@tarojs/components-qa: 2.2.3 => 2.2.3
@tarojs/mini-runner: 2.2.3 => 2.2.3
@tarojs/mobx: 2.2.3 => 2.2.3
@tarojs/mobx-h5: 2.2.3 => 2.2.3
@tarojs/router: 2.2.3 => 2.2.3
@tarojs/taro: 2.2.3 => 2.2.3
@tarojs/taro-alipay: 2.2.3 => 2.2.3
@tarojs/taro-h5: 2.2.3 => 2.2.3
@tarojs/taro-qq: 2.2.3 => 2.2.3
@tarojs/taro-quickapp: 2.2.3 => 2.2.3
@tarojs/taro-swan: 2.2.3 => 2.2.3
@tarojs/taro-tt: 2.2.3 => 2.2.3
@tarojs/taro-weapp: 2.2.3 => 2.2.3
@tarojs/webpack-runner: 2.2.3 => 2.2.3
eslint-config-taro: 2.2.3 => 2.2.3
eslint-plugin-taro: 2.2.3 => 2.2.3
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6
stylelint-config-taro-rn: 2.2.3 => 2.2.3
stylelint-taro-rn: 2.2.3 => 2.2.3
taro-ui: ^2.2.4 => 2.2.4

@zcSkr
Copy link

zcSkr commented May 6, 2020

我也刚发现,5.1没休息吗老李,写 bug去了吧哈哈

@zcSkr
Copy link

zcSkr commented May 7, 2020

老李说css-loader依赖包的问题
暂时可以进入 node_modules 的 @tarojs/webpack-runner 目录里将css-loader安装到 2.1.1

@zhangminggeek
Copy link

插眼关注

@nvsky
Copy link

nvsky commented May 11, 2020

我也出现这问题,怎么解决了?
image

@nvsky
Copy link

nvsky commented May 12, 2020

@tarojs/webpack-runner": "2.1.1"临时从2.2.3降到2.1.1解决了

luckyadam added a commit that referenced this issue May 13, 2020
## 特性
- 添加 mdns 相关 api,close #6258

## 修复
- 修复使用 sass 打包项目时多端样式失效的问题,close #6218 
- 修复 css-loader 升级到 3.0.0 后带来 breaking change 问题,close #6191
- 修复对头条、京东小程序的原生样式编译的支持,close #6242
- 修复 service 和 helper 类型缺失问题
- 修复 H5 tabbar 跳转问题
- 修复 App 的 config 为静态属性时获取不到 config 对象的问题
- 修复 modifyWebpackChain 可能失效的问题
@cdd111
Copy link

cdd111 commented Aug 19, 2020

module.exports = {
// ...
h5: {
// ...
cssLoaderOption: {
localIdentName: '[hash:base64]'
}
}
}
这么配置还是会报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants