useCssModule is broken on Vue 2.7

This issue has been created since 2022-10-12.

Version

2.7.11

Reproduction link

codesandbox.io

Steps to reproduce

const style = useCssModule()
console.log(style.someClass) // undefined
// ...
<style module lang="css">
.someClass {
  background: pink;
}
</style>

What is expected?

style object should contain defined class names

What is actually happening?

style object is empty.

In console: [Vue warn]: Current instance does not have CSS module named "$style"


I checked https://github.com/vuejs/core/blob/v2-compat/packages/runtime-dom/src/helpers/useCssModule.ts which uses getCurrentInstance, but on vue 2.7 getCurrentInstance returns { proxy: Vue }.
Maybe that's something else :p

skirtles-code wrote this answer on 2022-10-15

I believe this is the same issue as #12822.

Ansett wrote this answer on 2022-10-15

Seems so, I didn't search well enough :(

sodatea wrote this answer on 2022-10-15

Let's close this and track it in #12822 instead.

More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-12-10
Star Count 201155
Watcher Count 6070
Fork Count 33134
Issue Count 595

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Why calculate IoU from voxel label? 0 2021-06-10 2022-10-30
Kind request for an arm64 compatible version, which might be used in Chromebook, not just raspberry pie. 0 2021-06-22 2022-10-16
A real stupid question. (token gen) 1 2021-12-18 2022-10-14
Errors on the Token Grabber 1 2021-12-08 2022-10-05
Issues with Inventory (Failed to handle packet with id 0x16:) 6 2022-08-30 2022-09-02
Dead link in source code 0 2021-08-28 2022-04-04
Information request: adaptation to JIS keyboard 0 2021-08-28 2022-08-01
Could not get it to work on Fedora 34 (Gnome 40) 8 2021-05-16 2022-07-29
bug `’’` instead of `dead key` on windows 10 pro 9 2018-12-24 2022-04-04
Git fetch is invalid 2 2022-04-04 2022-10-19
Creates Transaction Error 0 2021-01-15 2022-09-27
BUG: Dying in Avant Gardens Survival causes you to lose coins 1 2022-01-30 2022-10-16
Change the deactivation intent UI 1 2022-03-28 2022-10-15
Could not download source map specified in the minified js file 0 2022-05-13 2022-07-23
TypeError: Failed to fetch 0 2022-05-13 2022-07-23
traefik-prometheus-grafana 3 2022-03-31 2022-11-12
undefined is not an object (evaluating '_useInternal.state') 10 2021-04-22 2022-11-11
inputPath option throws error: The "path" argument must be of type string. Received undefined 2 2021-02-27 2022-11-28
[api] Docker Deployment: No login possible 3 2021-06-06 2022-11-26
Make Coldarra great again! 4 2022-10-08 2022-11-12
Harbor Guard, Boralus Gossip 2 2022-10-10 2022-10-25
Add a Dockerfile for the React App 1 2021-07-05 2022-09-13
Boilerplate spitting out strange header 4 2021-04-07 2022-11-17
Missing CORS middleware 1 2021-01-25 2022-11-17
Feature request: Print explicit curried functions in curried syntax 2 2021-08-27 2022-10-22
[Bug]: Boxing of structs to compute hashcode is causing excessive allocations 1 2022-06-11 2022-08-27
Call for transparent HTTP status codes in generated struct 4 2022-02-03 2022-10-02
No reset password option in login screen 1 2022-07-05 2022-11-29
Can we pause the downloading ? 1 2021-08-31 2022-10-01
a brief option for steampipe check that works for --export 1 2022-08-26 2022-12-10
Statement text sometimes doesn't show on the Transactions page 2 2021-10-22 2022-11-04
How to get the current cursor position? 5 2022-07-05 2022-12-02
[Enhancement] Combinations 5 2021-10-14 2022-12-03
libpng error: IDAT: CRC error QPixmap::scaled: Pixmap is a null pixmap 0 2022-10-10 2022-11-03
uni-popup-dialog未适配uni.scss主题色 1 2021-07-24 2022-11-20
Slider placement adjustments don't snap correctly to time values 0 2022-11-01 2022-11-07
Searching settings will show the categories of hidden settings. 1 2022-10-31 2022-11-07
Assemble fatjar give problem with dialect 4 2021-10-12 2022-11-28
empty <head> in content page results in ERROR ArrayIndexOutOfBoundsException: -2 2 2020-11-17 2022-11-28
scripted play-sbt-plugin/dev-mode: configuration error 3 2021-07-19 2022-11-13
Proposal: unpublish extension from marketplace 3 2021-06-02 2022-10-25
how can query on multiple indexes,like we do in sql join ( inner join,left join etc) using DSL in opensearch 10 2022-09-26 2022-10-17
Type promotion fails on local function call 2 2021-10-02 2022-10-02
Some bash commands cannot be found when connected to remote Ubuntu device 6 2021-11-10 2022-10-24
Serial keeps outputting after Ctrl+C 3 2021-08-31 2022-09-20
Subscribers form: Update text, replace "followers" with "subscribers" 0 2022-07-21 2022-10-28
exec in child_porcess does not recognise pnpm as a comand 2 2022-05-25 2022-11-14
The addon submission API allows add-on names to include only symbols 1 2022-03-31 2022-11-28
Swoole not reflecting changes after deployment via Envoyer 1 2022-01-03 2022-11-25
Please merge RCE vulnerability fix into Spring Boot 2.7.0 1 2022-03-31 2022-10-03