reskript icon indicating copy to clipboard operation
reskript copied to clipboard

把特殊全局变量模块化

Open otakustay opened this issue 3 years ago • 0 comments

现在的代码是这样的:

if (skr.features.foo) {
    // 代码
}

console.log(skr.build.target);

模块化以后,期望是这样:

import {foo} from '@skr/features';
import {target} from '@skr/build';

if (foo) {
    // 代码
}

console.log(target);

这个在SWC中可以用constModules搞定,但其它编译方案不知道有没有替代的

otakustay avatar Jul 25 '22 14:07 otakustay