one
Version:
One is a React framework for web, iOS, and Android apps.
30 lines (27 loc) • 808 B
JavaScript
import { isBuiltin } from "module";
import path from "path";
function nodeExternals() {
return {
name: `node-externals`,
enforce: "pre",
resolveId: {
order: "pre",
async handler(specifier, importer, options) {
if (options === null || options === void 0 ? void 0 : options.scan) return null;
if ((options === null || options === void 0 ? void 0 : options.isEntry) || /^(?:\0|\.{1,2}\/)/.test(specifier) || path.isAbsolute(specifier)) {
return null;
}
if (isBuiltin(specifier)) {
var stripped = specifier.replace(/^node:/, "");
return {
id: !isBuiltin(stripped) ? "node:" + stripped : stripped,
external: true,
moduleSideEffects: false
};
}
}
}
};
}
export { nodeExternals };
//# sourceMappingURL=customNodeExternals.native.js.map