config/index.js 区分 dev prod,fixed store.js userpage.js 等

This commit is contained in:
hupeng committed 2026-06-18 16:11:44 +08:00
1 parent ea2267598b
commit 883919244f
8 files changed
+44 -23

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
export const IS_DEV = process.env.NODE_ENV !== 'production'
const noop = () => {}
function createLogMethod(method) {
if (IS_DEV) {
return (...args) => console[method](...args)
}
return noop
}
export const logger = {
debug: createLogMethod('log'),
info: createLogMethod('info'),
warn: createLogMethod('warn'),
error: createLogMethod('error'),
}