refactor: only run useCssModule code in non-global builds
This commit is contained in:
parent
e8e67729cb
commit
86464e8c04
@ -2,7 +2,8 @@ import { getCurrentInstance } from '../component'
|
||||
import { EMPTY_OBJ } from '@vue/shared'
|
||||
import { warn } from '../warning'
|
||||
|
||||
export function useCSSModule(name = '$style'): Record<string, string> {
|
||||
export const useCSSModule = (name = '$style'): Record<string, string> => {
|
||||
if (!__GLOBAL__) {
|
||||
const instance = getCurrentInstance()!
|
||||
if (!instance) {
|
||||
__DEV__ && warn(`useCSSModule must be called inside setup()`)
|
||||
@ -20,4 +21,10 @@ export function useCSSModule(name = '$style'): Record<string, string> {
|
||||
return EMPTY_OBJ
|
||||
}
|
||||
return mod as Record<string, string>
|
||||
} else {
|
||||
if (__DEV__) {
|
||||
warn(`useCSSModule() is not supported in the global build.`)
|
||||
}
|
||||
return EMPTY_OBJ
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user