one
Version:
One is a new React Framework that makes Vite serve both native and web.
22 lines (21 loc) • 1.08 kB
JavaScript
function pluginInlineOneServerUrl() {
var serverUrl = process.env.ONE_SERVER_URL;
return {
visitor: {
MemberExpression(nodePath) {
var _node_object, _node_object_object, _node_object_property, _node_property;
var {
node
} = nodePath;
if (((_node_object = node.object) === null || _node_object === void 0 ? void 0 : _node_object.type) === "MemberExpression" && ((_node_object_object = node.object.object) === null || _node_object_object === void 0 ? void 0 : _node_object_object.name) === "process" && ((_node_object_property = node.object.property) === null || _node_object_property === void 0 ? void 0 : _node_object_property.name) === "env" && ((_node_property = node.property) === null || _node_property === void 0 ? void 0 : _node_property.name) === "ONE_SERVER_URL") {
nodePath.replaceWith({
type: "StringLiteral",
value: serverUrl || ""
});
}
}
}
};
}
export { pluginInlineOneServerUrl as default };
//# sourceMappingURL=inline-one-server-url.native.js.map