taro icon indicating copy to clipboard operation
taro copied to clipboard

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

Open azhaorz opened this issue 6 years ago • 10 comments

问题描述

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 `

azhaorz avatar Apr 30 '20 17:04 azhaorz

CC @Littly

taro-bot avatar Apr 30 '20 17:04 taro-bot

欢迎提交 Issue~

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

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

Good luck and happy coding~

taro-bot avatar Apr 30 '20 17:04 taro-bot

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

luckyadam avatar May 06 '20 02:05 luckyadam

同样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

divcss3 avatar May 06 '20 07:05 divcss3

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

zcSkr avatar May 06 '20 10:05 zcSkr

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

zcSkr avatar May 07 '20 02:05 zcSkr

插眼关注

zhangminggeek avatar May 09 '20 06:05 zhangminggeek

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

nvsky avatar May 11 '20 11:05 nvsky

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

nvsky avatar May 12 '20 10:05 nvsky

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

cdd111 avatar Aug 19 '20 09:08 cdd111