@figma/code-connect
Version:
A tool for connecting your design system components in code with your design system in Figma
22 lines • 959 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClient = getClient;
// `client/external`'s dependency chain ends up including code which is not safe
// in a browser context, e.g. `child_process`. This would mean that if you
// co-locate your Code Connect with React components, your app will be broken in
// a browser, because of this import chain.
//
// To get around this, we only import `client/external` if you are in a Node
// context – it is only used for the icon script, so none of the code which runs
// in the browser should touch it.
//
// Note that you may still see messages from the JS bundler about Node modules,
// but these won't be included at runtime.
function getClient() {
let client = {};
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
client = require('../client/external');
}
return client;
}
//# sourceMappingURL=index_common.js.map