chore: umd version will try to reuse global @ant-design/cssinjs first (#46009)

* chore: alias of it

* chore: comment
This commit is contained in:
二货爱吃白萝卜
2023-11-22 15:04:55 +08:00
committed by GitHub
parent e5a69664c3
commit 3233ac498f
2 changed files with 29 additions and 0 deletions

19
alias/cssinjs.js Normal file
View File

@@ -0,0 +1,19 @@
/* eslint-disable global-require, import/no-unresolved */
// This is a alias proxy, which will use global `@ant-design/cssinjs` first.
// Use local if global not found.
let cssinjs;
if (typeof window !== 'undefined' && window.antdCssinjs) {
// Use window UMD version
cssinjs = window.antdCssinjs;
} else if (typeof global !== 'undefined' && global.antdCssinjs) {
// Use global UMD version
cssinjs = global.antdCssinjs;
} else {
// Use local version.
// Use relative path since webpack will also replace module here.
cssinjs = require('../node_modules/@ant-design/cssinjs');
}
module.exports = cssinjs;