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.
`
👽 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
`
CC @Littly
欢迎提交 Issue~
如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏
如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。
Good luck and happy coding~
没有复现,麻烦检查下 cli 与项目依赖版本是否一致
同样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
我也刚发现,5.1没休息吗老李,写 bug去了吧哈哈
老李说css-loader依赖包的问题
暂时可以进入 node_modules 的 @tarojs/webpack-runner 目录里将css-loader安装到 2.1.1
插眼关注
我也出现这问题,怎么解决了?

@tarojs/webpack-runner": "2.1.1"临时从2.2.3降到2.1.1解决了
module.exports = {
// ...
h5: {
// ...
cssLoaderOption: {
localIdentName: '[hash:base64]'
}
}
}
这么配置还是会报错
Most helpful comment
同样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